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

查看:18
本文介绍了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天全站免登陆