0

I have the following code in viewDidLoad to add two buttons on the right of a UINavigationBar - I omitted the code of the left "Cancel" button.

    UIBarButtonItem *doneButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemDone
                                                                                    target: self
                                                                                    action: @selector(done:)];

    UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemAdd
                                                                                    target: self
                                                                                    action: @selector(add:)];

    NSArray* buttons = @[addButton, doneButtonItem];
    self.navigationItem.rightBarButtonItems = buttons;

Works great, but it doesn't look good, the "+" symbol seems bigger than the word "Done" and they appear off center of each other:

enter image description here

Is there a way to make this look nicer?

koen
  • 5,383
  • 7
  • 50
  • 89

1 Answers1

0

You are using the default SystemItem, and I believe it's exactly how they should look like. Apple definitely had tuned the layout, so it's actually unnecessary to modify the position.

My suggestion is just keep it, don't do anything.

However, if you really want to change the default position, here are many solutions: Change position of UIBarButtonItem in UINavigationBar

Community
  • 1
  • 1
Brian
  • 30,156
  • 15
  • 86
  • 87
  • I wonder if it has to do with the fact that I'm using a different font (Avenir) for the title. Maybe the dimensions of the plus sign are optimized for the standard system font. I will to look into that later today. – koen Apr 15 '15 at 12:00