Purpose: setting the entire back button on the UINavigationBar to a white icon
Steps: 1. in the method "didFinishLaunchingWithOptions" AppDelete:
UIImage * backBtnIcon = [UIImage imageNamed: @ "navBackBtn"];
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { [UINavigationBar appearance].tintColor = [UIColor whiteColor]; [UINavigationBar appearance].backIndicatorImage = backBtnIcon; [UINavigationBar appearance].backIndicatorTransitionMaskImage = backBtnIcon; }else{ UIImage *backButtonImage = [backBtnIcon resizableImageWithCapInsets:UIEdgeInsetsMake(0, backBtnIcon.size.width - 1, 0, 0)]; [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -backButtonImage.size.height*2) forBarMetrics:UIBarMetricsDefault]; }
2. in the viewDidLoad method of the regular SuperController class:
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) { UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil]; [self.navigationItem setBackBarButtonItem:backItem]; }else{
Jagie
source share