Button Hiding the text in iOS6 - ios

I have a text box which has a popover. Also placed a button on top of the text box to make it clickable so that when button is clicked the popover is opened and any item selected will be shown in the text box. This is working fine in iOS7 but in iOS 6 i am able to select the item in popover but the button is hiding the text. Tried setting colour of button but didn't work.
Please help.

If you set the type of the button to "Custom", and you don't set an Image or a Background Image, the button will be invisible on versions prior to iOS7 too.
If you create the button programmatically:
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
If you change it on your interface:

Instead of using button, you can open popover by UITextbox itself. Just place the button's IBAction code in textbox's IBAction with EditDidBegin Event.

Set UIbutton's buttontyoe to UIButtonTypeCustom for iOS 6

Related

Tint UIBarButtonItems in inputAssistantItem on iPad

I have a couple of UIBarButtonItems used to apply formatting to text in a UITextView. On iPhone, these buttons are added to a UIToolbar that's set as the inputAcessoryView for the textview. On iPad, the buttons are added to the textview's inputAssistantItem toolbar instead.
The states of the buttons are toggled on or off by changing the tintColor of the UIBarButtonItems (i.e. when the currently selected NSRange should be bold the tintColor of the bold button is changed to indicate that it is active).
This works great when the UIBarButtonItems are added to a UIToolbar on iPhone, but I can't get this to work for the inputAssistantItem on iPad. When I change the tintColor of a button, nothing changes.
For anyone interested, I managed to fix this by adding a UIButton to to each UIBarButtonItem and then changing the tintColor of the button instead of the UIBarButtonItem.

UIButton within UITableViewCell is Tappable(Getting proper event) But the issue is tap effect is not visible

I have a custom table view cell with UILable and UIButton which is working fine I am getting proper event on button tap, but the issue is tap effect of button is not visible in UI.
Edit - Functionality wise button is working fine but the issue is that on tap, tap effect is not visible see below attached image.
I am expecting below same smooth touch for button which is within tableview Cell -
add this on your button showsTouchWhenHighlighted and check once
button.showsTouchWhenHighlighted = TRUE
You can set the Text Color e.g Light Gray Color for the button's highlighted state in storyboard.
It will give a tap effect to your button.

Click on Disabled button on top of other button triggers the other button's click event

I have a disabled button on top of enabled button:
The green button is disabled. When I click it, it triggers a click on the blue button behind.
I tried:
self.testButton.enabled = YES;
self.testButton.userInteractionEnabled = NO;
But I still got the same behavior
Is there any way to prevent the blue button click event in this scenario?
Edit:
Fixed by not really disabling the button but changing it's target to nil:
[myButton addTarget:nil action:nil forControlEvents:UIControlEventTouchUpInside];
[myButton setImage:[UIImage imageNamed:#"disabledImage.png"] forState:UIControlStateNormal];
Yes, blue button will always get an action as green button is not enable or intractable.
So, here you need one overlay between these two buttons to stop tap event of green button.
How ever below approach is not efficient way to tackle down this scenario, but you can use it unless you will find better one.
Add green button in a UIView (Which work as an overlay between these two views) with same size as green button, add green button as a subview of this view and add this view at place of green button.
So that whenever you disable green button and tap on it. Tap will be on UIView which is a superview of green button.
Use view hierarchy :

uitoolbar with icons/text similar to uitabbar

Ideally I want to use a UIToolbar but I want the icons at the bottom to appear as they would in a UITabBar meaning with icon for default and highlighted states and title beneath. I know I can drag a UIButton onto the toolbar and it will create a UIButton inside of a UIBarButtonItem, but I can't seem to manipulate the UIButton to show a title beneath? The other problem I'm having is when I set the alignment of the button in IB (in the Control section) it only changes the alignment for the default state not the highlighted state. Can anyone give me some pointers here that would be great thanks!
rc
Putting the UIButton inside a UIBarButtonItem is the best way I've found to do it. Just set the text for the button and it should show up fine. When manipulating the positioning, remember you're manipulating the position of the UIBarButtonItem and not the UIButton. Hope that helps!

How to turn off button shadow on button press of UIButton?

I've created a UIButton in InterfaceBuilder. When a user presses the button, the entire button is shaded grey. Is there a way to alter this behavior so the button is no longer shaded grey when the button is pressed?
Uncheck "Highlighted Adjusts Image" in Interface Builder.
Alternatively, set the adjustsImageWhenHighlighted property of the UIButton to NO.
Change the button type to custom from system in the attributes inspector of the button

Resources