Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay I solved the issue, using a bit of a rough trick, but at least it works. If anyone does come up with a more standard solution though, please let me know!</p> <p>Here's my code:</p> <pre><code>UIImage *backButtonImage = [[UIImage imageNamed:@"Graphics/Shared/navigation_back_button.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)]; [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, backButtonImage.size.height*2) forBarMetrics:UIBarMetricsDefault]; </code></pre> <p>This is in my appdelegate's method:</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions </code></pre> <p>To stop it stretching when using it as a background, I used the idea from <a href="https://stackoverflow.com/questions/10757565/ios-5-xcode-4-3-2-how-to-implement-a-custom-image-back-button">iOS 5: How to implement a custom (image) back button</a></p> <p>But then tweaked it so rather than having to set-</p> <pre><code>self.title = @" "; </code></pre> <p>On every view load (and that might also mess with the nav bar title itself)</p> <p>I just set the offset for the 'back' button text to twice the image height, so you'll never see it.</p> <p>Why go to all this trouble, rather than use a left button item with it's own method to pop the view controller?</p> <p>The main reason is that you lose the standard back button sliding animation for changing views. Also, this means I don't need to use a custom button or write a custom method for going back. It simply just works.</p> <p>Hope this solves someone else's problem too, I know I was stuck on it for a good 3 hours!</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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