Search code examples
uinavigationcontrolleruibuttonuinavigationbaruibarbuttonitemuinavigationitem

leftBarButtonItem in UINavigationItem


I've looked through several threads and come to a solution that I thought would work.

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"backbutton.psd"]
                                                               style:UIBarButtonItemStyleBordered target:self
                                                              action:@selector(barButtonBackPressed:)];
self.navigationItem.leftBarButtonItem = backButton;

This gives me nothing.

When I add this it gives me a regular blue bordered button (which isn't what I want) with the text "Back":

backButton.title = @"Back";

I don't get it.


Solution

  • I believe it's because you're using a PSD image file. That's not a supported format according to Apple documentation.