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:
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];
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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.