Note that there are some explanatory texts on larger screens.

plurals
  1. POUIBarButtonItem shifting downwards after a UINavigationController push
    primarykey
    data
    text
    <p>My app runs in a UINavigationController. When I push in a new view controller from the right, the top right UIBarButtonItem (Edit) shifts down by 1 pixel — the Edit button stays in place, but the graphic noticeable shifts down. </p> <p>I've noticed this only happens after I set up a UIAppearance proxy for the bar button item. This is my code for doing that:</p> <pre><code>UIImage *barButton = [[UIImage imageNamed:@"navBarBarButton"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)]; [[UIBarButtonItem appearance] setBackgroundImage:barButton forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; </code></pre> <p>navBarBarButton.png is a 52x31 bar button image. </p> <p>Other potentially relevant info:</p> <ul> <li>This only happens in the iOS 6 simulator — it's fine in iOS 5.</li> <li>This app uses storyboards, and the pushes are handled by segues. </li> <li>The one-pixel displacement only happens once, i.e. it doesn't get pushed down a second time when I go another level into a navigation controller.</li> <li>The Edit button's text stays where it is; only the button graphic moves. </li> <li>I tried starting the app in a different view controller (i.e. the second in the navigation stack). The bar button item shows up at the normal (higher) position, then shifts downwards when I push in a new view. This seems to suggest it's not related to any specific view controller.</li> </ul> <p>Has anyone seen this, know why this is happening, or how to prevent the button from shifting? Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload