开发者

popToRootViewControllerAnimated not working correctly

I have a navigation app and when certain errors occur I want to dump the开发者_Python百科 user back on the view they started on so I have the following code execute in those conditions:

[self.navigationController popToRootViewControllerAnimated:YES];

When it executes the root view isn't always displayed and/or the navigation bar will have the wrong title. Sometimes the navigation bar will even have the back button showing on it and how could that be on what's supposed to be the root view?

I tried using NO for the animated parameter and that didn't help.

I also moved logic from viewDidLoad into viewWillAppear in the root controller since I originally set the title in there, and other things, and that didn't help either. The title for the navigation bar was still always wrong and still had a back button displayed on it.

I'd appreciate some constructive suggestions. FYI, I'm running 3.1.2.


Not sure if it's the same thing but I've found that if you try to popToRoot without a significant time lag from the intial push of the one or more viewcontrollers the apps can't handle it. I was lucky in that I had reason to put in a fake waiting window in my app with a 2 second delay. With the delay in place the same popToRoot code worked fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜