简体   繁体   中英

UINavigation bar back button in ios 7

i am developing a application which have a activity indicator in UINavigationbar and the problem is that when i hide the activity indicator the default navigation back button not displayed in ios 7 but in ios 6 it works perfectly

i am getting self.navigationItem.backBarButtonItem as nil when i print it in console

after hiding activity indicator i have written below code

[self.navigationItem setLeftBarButtonItem:self.navigationItem.backBarButtonItem];

Thanks in advance

Instead of:

[self.navigationItem setLeftBarButtonItem:self.navigationItem.backBarButtonItem];

Try using:

[self.navigationItem setBackBarButtonItem:self.navigationItem.backBarButtonItem];

(I'm not sure if this is going to work exactly like this. It's possible that you'll have to store the back button in a variable prior to showing the activity indicator and than set the back button to that variable afterwards.)

I'm a rank beginner, but my understanding is that the back button displayed is actually a property of the the previous view controller, not of the view controller which is displayed.

Unless you've manually set a back button for the currently visible view controller, it should be nil.

Try logging the back button item from of the previous view controller in the stack, that might help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM