Question

I'm trying to have a custom back button with image only (no text).

I'm aware that there could be slightly ifferent solution for iOS7 and iOS6. For now I'm not successfull with any.

All I achieved was this:

enter image description here

White default arrow is still there :(

I used this code:

    UIImage *temp = [[UIImage imageNamed:@"button_back.png"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
    UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:temp style:UIBarButtonItemStyleBordered target:self action:@selector(action)];
    [[self navigationItem] setBackBarButtonItem:backButton];
Was it helpful?

Solution

You should use leftBarBttonItem for custom back button

 UIImage *temp = [[UIImage imageNamed:@"button_back.png"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
 UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:temp style:UIBarButtonItemStyleBordered target:self action:@selector(action)];
 self navigationItem.leftBarButtonItem = backButton;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top