I am transforming some apps for iOS7 and have problems with the text in buttons placed in the Toolbar. Looks like the font size is much bigger and not possible to resize. So my text buttons which fitted so nicely in iOS6 are not possible any more. The screen is not wide enough. Is it possible to adjust this without redoing the whole app? Why this stupid change? I really want to adapt the apps to iOS7 of several other reasons.
You can set the title text attributes of UIBarItems (including UIBarButtonItems) using setTitleTextAttributes:forState:
. For example, to set the title text font for all UIBarButtonItems, you can do this:
[[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:9.0]} forState:UIControlStateNormal];
Or, to set it for just one,
[myBarButton setTitleTextAttributes:@{NSFontAttributeName : [UIFont boldSystemFontOfSize:9.0]} forState:UIControlStateNormal];
You can also create UIBarButtonItems that contain UIButtons, and have complete control over how those UIButtons appear (font, font size, etc.). This can be done in Interface Builder by dragging a UIButton onto your UIToolbar, or in code:
UIButton* button = ...;
UIBarButtonItem* barButton = [[UIBarButtonItem alloc] initWithCustomView:button];
[toolbar setItems:@[barButton, ...] animated:YES];
Note that your IBActions/segues will need to be hooked up to the UIButton instead of the UIBarButtonItem if you take this approach.