Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
761 views
in Technique[技术] by (71.8m points)

xcode - iOS: popViewController unexpected behavior

I've been searching the internet for a solution. There's nothing I could find. So: I'm using a UINavigationController. I am pushing two UIViewControllers onto it. In the second pushed ViewController i am executing this code:

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error {
NSLog([error localizedDescription]);
[self.navigationController popViewControllerAnimated:YES]; }

The expected thing to happen would be that the last pushed ViewController disappears. In this app I am doing this on few places and it works fine everywhere expect in this very ViewController. What happens is that only the back button goes off screen (animated) but everything else stays on screen. In the Console Output two things are printed out when this line executes:

2011-03-14 16:32:44.580 TheAppXY[18518:207] nested pop animation can result in corrupted navigation bar

2011-03-14 16:32:53.507 TheAppXY[18518:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

Two error messages I couldn't find ANY information on. I'm using XCode 4 and iOS SDK 4.3. Maybe anyone can help me with this problem.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I came across a similar situation in my code and the message said:

nested push animation can result in corrupted navigation bar

Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree >might get corrupted.

My finding to this issue was that I was pushing 2 view controllers one after the other in quick succession and both were animated.

In your case it seems that you might be popping multiple view controllers with animation one after the other.

Hence, while one view is undergoing animation you should not start animation on another view.

I also found that if I disabled animation on one view, the error message disappeared.

In my case it was a problem with the flow logic as I did not intend to push 2 view controllers one after the other. One was being pushed within the switch case logic and another after its end.

Hope this helps someone.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...