2

When i updated my app to iOS 7, my customize back button image is not visible for the very first time. Once i Click to the icon, button is visible.

Can anybody tell me how can I customize back button image using the following code

 self.navigationController.navigationBar.backIndicatorImage = [UIImage imageNamed:kBackButtonImage];
 self.navigationController.navigationBar.backIndicatorTransitionMaskImage = [UIImage imageNamed:kBackButtonImage];

I dont want to set custom image using the following code

  • Create a custom UIBarButtonItem and manually assign it as UINavigationItem's leftBarButtonItem.
Petr Janeček
  • 37,768
  • 12
  • 121
  • 145
user2814546
  • 107
  • 8
  • seems like it's an iOS 7 bug. Hope they fix it soon. – zumzum Sep 30 '13 at 23:10
  • You might see if my answer at http://stackoverflow.com/a/19452709/1754225 works, if you can't change to a more iOS7-like borderless style (with no background), or some of the other approaches mentioned on similar questions. – Carl Lindberg Oct 18 '13 at 15:15

1 Answers1

0

Try to set UIBarButtonItem like this way in ios7:-

UIImage *temp = [[UIImage imageNamed:@"theImage"] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];    
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithImage:temp style:UIBarButtonItemStyleBordered target:self action:@selector(action)];

Here is an original post in apple Dev center discussion Forums

For supporting both version iOS7 as well as lower then you check system-version and set code like:-

UIImage *temp=nil;

if([[[UIDevice currentDevice] systemVersion] floatValue] < 7.0)
{ 
temp = [UIImage imageNamed:@"btn-back.png"]; 
}
else
{ 
temp = [[UIImage imageNamed:@"btn-back.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
}
kondapaka
  • 132
  • 1
  • 10