Questions tagged [uibarbuttonitem]

UIBarButtonItem is a button specialized for placement on a UIToolbar or UINavigationBar object. It inherits basic button behavior from its abstract superclass, UIBarItem. The UIBarButtonItem defines additional initialisation methods and properties for use on toolbars and navigation bars. There are some methods for customizing Appearance. Available in iOS 2.0 and later in UIKit.

A bar button item is a button specialized for placement on a UIToolbar or UINavigationBar objects. It inherits basic button behavior from its abstract superclass, UIBarItem. The UIBarButtonItem defines additional initialization methods and properties for use on toolbars and navigation bars.

iOS includes a number of system-provided items with specific icons, but developers can create custom items as well.

Note: UIBarButtonItem is not a descendent of UIView, so many common tasks like applying animations or transforms can be more difficult than you might expect.

UIBarButtonItem Class Reference

2349 questions
50
votes
8 answers

Changing the Tint Color of UIBarButtonItem

I have a project using Storyboards and whenever I push a view controller with a segue, the dynamically created bar button item is always blue. It's driving me nuts. Because this object is created dynamically, I cannot set its color in IB (like I…
Andy Ibanez
  • 12,104
  • 9
  • 65
  • 100
48
votes
8 answers

Change font of back navigation bar button

I want to be able to set the font of my apps navigation bar back button without doing anything too crazy and without losing any other design characteristics of the button (i.e. I want to keep the arrow). Right now I use this in viewDidAppear: to set…
zachjs
  • 1,738
  • 1
  • 11
  • 22
46
votes
4 answers

iOS - UIBarButtonItem Identifier - option to create "settings" cogwheel button

I want to create a UIBarButtonItem to represent the app's settings (cogwheel). Presently I can only find an option to create UIBarButtonItem (Interface Builder > Attributes Inspector > identifier) such as "Add" (+), "Edit", "Done", "Cancel" etc I…
user1046037
  • 16,755
  • 12
  • 92
  • 138
45
votes
6 answers

How can I have a UIBarButtonItem with both image and text?

When I try to use an image for a UIBarButtonItem, the text isn't shown. Is there a way to show both the text and the image?
node ninja
  • 31,796
  • 59
  • 166
  • 254
42
votes
11 answers

UISearchBar cancel button color?

When I drop a UISearchBar into my view inside Interface Builder, and change its style to Black Opaque, the cancel button stays unfittingly blue / gray and doesn't become black. How can I make the cancel button black? EDIT: It does work like this: //…
cactus
  • 421
  • 1
  • 4
  • 5
41
votes
6 answers

How do you set the font size on a UIBarButtonItem?

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?
Jim
  • 890
  • 2
  • 10
  • 22
41
votes
17 answers

Make a UIBarButtonItem disappear using swift IOS

I have an IBOutlet that I have linked to from the storyboard @IBOutlet var creeLigueBouton: UIBarButtonItem! and I want to make it disappear if a condition is true if(condition == true) { // Make it disappear }
40
votes
15 answers

How can you add a UIGestureRecognizer to a UIBarButtonItem as in the common undo/redo UIPopoverController scheme on iPad apps?

Problem In my iPad app, I cannot attach a popover to a button bar item only after press-and-hold events. But this seems to be standard for undo/redo. How do other apps do this? Background I have an undo button (UIBarButtonSystemItemUndo) in the…
SG.
  • 401
  • 1
  • 5
  • 3
39
votes
5 answers

Can I have a UIBarButtonItem with a colored image?

I have an image that I want to display on a UIBarButtonItem, but for some reason it only shows the outline of it and the rest is all white. How can I have it actually display the image? Thanks!
DevDevDev
  • 5,107
  • 7
  • 55
  • 87
38
votes
1 answer

How to animate a button change in UINavigationBar?

I am calling the -(void)setEditing:(BOOL)editing animated:(BOOL)animated method in my code to swap between two buttons on the RHS of my navigation bar. -(void)setEditing:(BOOL)editing animated:(BOOL)animated { [super setEditing:editing…
creednmd
  • 2,001
  • 2
  • 18
  • 25
37
votes
8 answers

UINavigationBar UIBarButtonItems much larger click area than required

hopefully someone can help me out- iv'e scoured the net for the answer and cannot find one- the UIBarButtonItems added to UINavigationBar have a much larger click area than required- for example, open up any project you have a nav bar with buttons…
dave
  • 883
  • 3
  • 11
  • 13
35
votes
9 answers

UIBarButtonItem image stays blue and not the original color of the image?

How come the icon info.png stays blue and don't comes with the original color of that image? I am using the following code below: self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"info.png"] …
Jan
  • 653
  • 1
  • 7
  • 22
33
votes
10 answers

How to add Badges on UIBarbutton item?

Hi friends am new to iphone developing. Am struggle with add badge values on UIBarbutton item on right side. I have tried but i can't solve this problem. Can anyone help me. Thanks in advance!
Yuvaraj.M
  • 9,741
  • 16
  • 71
  • 100
33
votes
9 answers

navigation bar right bar button items spacing

I have created a with left bar button item added from storyboard, titleView and three right bar button items from code. Here is the code: override func viewDidLoad() { super.viewDidLoad() var screenWidth =…
mkz
  • 2,302
  • 2
  • 30
  • 43
32
votes
10 answers

Removing right bar button item from navigation item

I have added a right bar button item in my navigation item and want to remove this on some condition. This is what I am doing: self.navigationItem.rightBarButtonItem = nil; But not getting the desired behavior. I want to hide it but do not find any…
Abhinav
  • 37,684
  • 43
  • 191
  • 309