문제

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];
도움이 되었습니까?

해결책

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top