Button Attributes is not working in Iphone - ios

I have a UIButton in a nib file(.xib) which uses the Attributed Title from IB, but does not reflected when runs on device.
My configuration for button is as follow:
but not reflected.

One reason could be you have again set the UIButton title by programmatically. If you set your button title from IB, and again set it from code. In runtime it take title from code.

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.

Changing Navigation Bar Title Font in Interface Builder

I've implemented a Navigation Controller for my View Controller with storyboard. Now i want changing navigation bar title font and size with Attribute Inspector but it doesn't work and i don't understand why. Title color changes but font dont.
ps: the color changing is visible only at runtime and not in the storyboard.
You need to select navigation Bar and then you can set relevant properties. Please check attached image. It might help you.
When I tried to set the font, my font field was grayed out. But all I needed to do was change type to System and then again to Custom. It worked:-) Now I can choose my custom font
For me Bartłomiej Semańczyk's change to system font & change back trick only works to set the font to a particular system-included font. For custom fonts that I've added, the font face gets set to my custom font but it always gets displayed as size ~16 or so regardless of what size I select in the storyboard.
So the best way I can find to do this is to set self.navigationController.navigationBar.titleTextAttributes in the view controller's viewDidLoad method.
Note that you don't need to do this in every view controller you push onto this navigation stack, just the first one that gets displayed since it sets the property on the navigationBar itself not on the navigationItem. If you're subclassing UINavigationController already, that's the most logical place to set this but I'd rather not subclass it just for this one line change.

Changing UIView attributes via Interface Builder

In Xcode 5 Can we change UIView attributes like background color through Interface builder. I am trying to change the background color on UIButton which inherits from UIView on interface builder but it looks like you could do that in Xcode 4.x on a custom button but in Xcode 5 that I have I do not see any options to change any attributes for the UIButton's UIView properties.
Go to the view section on the right and then click on "Show". The section will scroll up.

Button Hiding the text in iOS6

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

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!

Resources