I'm trying to remove the glow from a UIBarButton item so that my text appears to be a label instead of a button. I've seen various posts talking about how to do this through interface builder or by setting a boolean variable "showsTouchWhenHighlighted", but neither of these options are available to me it appears. I've tried setting the showsTouchWhenHighlighted in the .m viewDidLoad where I change the font and font-size but the UIBarButtonItem doesn't appear to have that property. I also only have the options in the following image to change in InterfaceBuilder.
相关问题
- what is the difference between bounded and unbound
- Is it possible to hide a UIToolbar with an animati
- UIBarButtonItem with separate portrait and landsca
- UIBarButtonItem with separate portrait and landsca
- didSelectViewController method not being called (w
相关文章
- Popover segue to static cell UITableView causes co
- Creating UIImage from CIImage
- Separator between toolbar items in UIToolbar
- How can I change the background color of a UIBarBu
- UIAlertViewStylePlainTextInput return key delegate
- AVCaptureDeviceOutput not calling delegate method
- How to call an action when UISwitch changes state?
- UIToolbar in a popover
There is a way to do this (a bit of a hack but it works). Just drag a
UIButton
into your toolbar (instead of aUIBarButtonItem
). Then aUIBarButtonItem
will be automatically be created for you as a superview for yourUIButton
. Then you just set it like this:UIBarButtonItem
UIButton
Here is a screenshot to use as reference:
Note: Just remember that from now on any updates on the text must be made on the
UIButton
try this:
`
`
note: self.barItem is a UIBarButtonItem added from the object library and placed between two flexible spaces.
another way is to remove the
[self.barItem setCustom:view]
line and change the parameters of the label (width) so that it fills the entire toolbar and set the alignment to middle and the font by yourself in code,