UIView with button below - objective-c

My question is easy with this drawing :
I have a view above the blue stroke. We can see the buttons behind because this UIView background image is transparent at the left of the button.
My problem is that buttons, behind the views are not clickable.
Is there a way to make them clickable (without playing with adding or removing the view above) ?
Thanks !
Regards,
Sébastien ;)

try to set the
[viewAboveTheBlueStroke setUserInteractionEnabled:false];
because normally the UIView steals the event handling from the other views what it covers (i.e your buttons) and it won't pass them after.

Your image link is broken.
However, you could set the buttonType of your UIBUtton to UIButtonTypeCustom
and then bring them to front:
[self.view bringSubViewToFron:myBut];
You could also consider add UIGestureRecognizers to your image in front instead.

Related

Adjusting UIbutton Image

My UIbutton was stretching my images I was assigning to it with
[self.BTN_pic_1 setImage:myPIC forState:UIControlStateNormal];
I used this code to the correct resizing mode like this
[self.BTN_pic_1 setContentMode:UIViewContentModeScaleAspectFit];
The aspect fit only works once I press the button. I want the Aspect Fit to start working as soon as I load the image.
How can I get the button to do that?
Use the imageEdgeInsets to control how the image is stretched.
or
Set the contentMode of the button's imageView instead of the button's.
[self.BTN_pic_1.imageView setContentMode:UIViewContentModeScaleAspectFit];
Disclaimer:
There are many posible answers to this, you'll probably need to be more specific before we can give you a definitive answer.
It is not the button's content mode you want to fix; it's the content mode of the button's imageView. That is what is holding the image you assign when you call setImage:forState:.

UIImageView overlapping effect inside a UIView

Check this URL http://krystalrae.com/
Scrolling down you will see a girl's cloths are changing on mouse wheel scrolling.
I have to create a iPad application where 3 images will appear likewise. The difference will be that in my case image change will occur horizontally rather than vertically in website. Also, i have to make it inside UIView with events touchesBegan, touchesMoved, touchesEnded and touchesCancelled
Help will be appreciated.
Thanks.
From your comment I gather that the problem is the resizing of the images in UIImageView when changing the bounds of the view.
You can set the contentMode of the image view to something else. The default is UIViewContentModeScaleToFill which is not what you want.
You could, for example, set the lower image view to UIViewContentModeBottom, and the upper image view to UIViewContentModeTop.
Don't forget to make sure your image views have sett the property maskToBounds set as YES.

Irregular shaped buttons using OBShapedButton with hidden image

I am trying to make an irregular shaped button with the OBShapedButton class. That's ok, created it without any problem, however I need the image to be transparent. So, I just want an area from the image which will be clickable, but the image won't be seen.
I tried setting alphas on image, imageView and on the button itself, however it doesn't work neither way.
How should I do it?
Maybe it could be done by something else, not an UIButton, but unfortunately I didn't find anything on the net that I could understand and use.
Ok, so the easiest way on how to do this is:
Subclass UIButton and add touchesBegan, touchesEnded, touchesMoved,
touchesCancelled.
Then on touchesBegan, hide the image of the button and show the correct image in background.
And finally on touchesEnded or touchesMoved, show again the image of the button.
Hope it will help someone :)

Remove or prevent the active widget highlight

In the above example image, how do I go about preventing the blue highlight you can see on the top and right side of the NSOutlineView control?
That's called the "Focus Ring". You should be able to stop your view from drawing it either through IB:
Or in code, using setFocusRingType::
[myView setFocusRingType:NSFocusRingTypeNone];

UISegmentedControl custom background image

I have UINavigationBar setup as image - some wood texture. I want to insert UISegmentedControl with 4 buttons on that bar. Buttons should have same texture with slightly changed tint.
One solution would be to change tint alpha of buttons background color, so that texture in background can get trough, but as I set alpha for tint in IB it doesn't save value, it always gets back to value 1.
I cant get UISegmentedControl to show background image, so finally gave up and decide to search for help...
Effect that is desired is one in iBooks app, with buttons in Navigation Bar.
Any link or small help would be appreciated..
This post describes the steps involved and has sample code: http://idevrecipes.com/2010/12/13/wooduinavigation/
https://github.com/xhan/PlutoLand/blob/master/PlutoLand/UI/PLSegmentView.h
a custom SegmentView that can specify two images(normal, clicked)
Do not bother with one of those custom segmented control packages if you're on iOS 5 or later.
Per Dylan's suggestion, use the Appearance functionality in iOS 5+.
See the top answer here:
Customizing Left & Right UISegmentedControl Buttons