Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove back arrow in iOS7

enter image description here

I want to incorporate a custom back button - I'm able to get the above result using

self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back-btn"] style:UIBarButtonItemStylePlain target:nil action:nil];

but how do you remove the native blue button?

like image 850
daihovey Avatar asked Dec 12 '13 04:12

daihovey


1 Answers

Use the below code to hide the back arrow:

self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back-btn"]
                                                                         style:UIBarButtonItemStylePlain
                                                                        target:nil
                                                                        action:nil];

if ([UINavigationBar instancesRespondToSelector:@selector(setBackIndicatorImage:)]) {
    [[UINavigationBar appearance] setBackIndicatorImage:[[UIImage alloc] init]];
    [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[[UIImage alloc] init]];
}
like image 83
manujmv Avatar answered Oct 26 '22 10:10

manujmv