To set the text with the stand, you set the new stand to the current viewController before clicking or presenting a new one that will display the text of the lining:
In your current viewController (and not the new one that will display the back button):
vc = [[MyNewViewController alloc]initWith...]; vc.title = @"New ViewController"; self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil]; [self.navigationController pushViewController:vc animated:YES];
So, if you want to remove the text, just use @"" as the title for the new lining.
To set the stand icon for the entire application, use the following code in the appDelegate class. Not every icon fits perfectly, so if you need to move it a bit, you can use "backInsets". In my example, the icon will move 2px down.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... ... [self customBackButtonIcon]; return YES; } - (void)customBackButtonIcon { UIEdgeInsets backInsets = UIEdgeInsetsMake(0, 0, -2, 0); UIImage *backImg = [[[UIImage imageNamed:@"back_button_white"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] imageWithAlignmentRectInsets:backInsets]; [[UINavigationBar appearance] setBackIndicatorImage:backImg]; [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:backImg]; }
Tested with iOS9
Rikco
source share