iPhone UINavigation问题 - 嵌套推送动画可能导致导航栏损坏 [英] iPhone UINavigation Issue - nested push animation can result in corrupted navigation bar

查看:96
本文介绍了iPhone UINavigation问题 - 嵌套推送动画可能导致导航栏损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直收到以下错误:

2011-04-02 14:55:23.350 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55:23.352 AppName[42430:207] nested push animation can result in corrupted navigation bar
2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.
2011-04-02 14:55:23.729 AppName[42430:207] Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

这是我正在做的事情。从视图控制器,我按下某个按钮时调用以下内容:

Here is what I am doing. From a view controller, I call the following when a certain button is pushed:

EventsViewController *viewController = [[EventsViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
navController.navigationBar.tintColor = [UIColor blackColor];
[self presentModalViewController:navController animated:YES];
[viewController release];
[navController release];

然后,如果在EventsController中按下某个按钮,我会调用:

Then, if a certain button is pushed in EventsController, I call:

SingleEventViewController *viewController = [[SingleEventViewController alloc] initWithEvent:[currentEvents objectAtIndex:indexPath.row]];
[self.navigationController pushViewController:viewController animated:YES];
[viewController release];

然后,如果在SingleEventViewController中按下某个按钮,我会调用:

Then, if a certain button is pushed in SingleEventViewController, I call:

EventMapView* viewController = [[EventMapView alloc] initWithCoordinates];
[[self navigationController] pushViewController:viewController animated:YES];
[viewController release];

所以是的,显然有嵌套的推动动画,但这不是正确的方法关于它?我检查了Apple的DrillDownSave代码,看起来他们是这样做的。我使用init方法而不是viewDidLoad方法是否重要?

So yea, it's obvious that there's nested push animations, but isn't this the right way to go about it? I checked out Apple's DrillDownSave code and this appears to be how they're doing it. Does it matter that I use init methods instead of viewDidLoad methods?

推荐答案

我已经弄明白了。显然,如果从UITableViewDelegate的-didSelectRowAtIndexPath方法之外调用-pushViewController,它就不起作用。将呼叫转移到该功能是有效的。很奇怪。

I've figured it out. Apparently if you call -pushViewController from outside of the -didSelectRowAtIndexPath method of a UITableViewDelegate, it doesn't work. Moving the call into that function worked. Weird.

这篇关于iPhone UINavigation问题 - 嵌套推送动画可能导致导航栏损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆