Am I using UINavigationController the wrong way?
I want the NavigationItem to stay static, so the only animation I want has to be the Content that is pushed or popped out of the screen. I didn't find a single clean solution so far.
What I did instead was to create a single instance of UINavigationItem (inside the appdelegate) and assigning it to each of the viewControllers navigationItems.This seems to work. Only the content is animated during the transition.
So my first question, is it legal to use the same NavigationItem on more than one ViewController?
My actual problem is that I when I call
[navigationController popRootViewController:animated:]
to go back开发者_如何学运维 to my main menu the app crashes - but only in case I have at least 4 ViewControllers on the history stack:
NSRangeException', reason: '*** -[NSMutableArray removeObjectAtIndex:]: index 1 beyond bounds [0 .. 0]
I found someone having the same issue, but the answer does not cover my case:
https://discussions.apple.com/thread/1976079?start=0&tstart=0
beyond bounds
means that you want to access an object which is not available in your array. It looks like you have a MutableArray
with only one value in it. Please check your array initialization code.
精彩评论