I can't find a way to set the font size of the title in a custom UIBarButtonItem. The only way I can think of getting around this is to set it as an image which I would like to avoid. Any other suggestions?
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
- How to control print font size
Create a UILabel and use
-initWithCustomView:
.As a concrete example of what KennyTM suggests, you create the UIBarButtonItem with something like the following (in code):
Then, you can add it as centered text on a UIToolbar (for instance) with the following:
(of course, to get proper formatting, the
rect
used for initializingtxtLabel
andtoolBar
should be the proper sizes.... but that's another exercise!)In a easy way, simply:
Objective-C:
Swift:
Swift5: