UINavigationController不弹出iPad上的UINavigationBar项目 [英] UINavigationController not popping UINavigationBar items on iPad

查看:126
本文介绍了UINavigationController不弹出iPad上的UINavigationBar项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常奇怪的问题与UINavigationController。
我在这里发现了一个非常类似的问题:

UINavigationController不弹出UINavigationBar项目

I'm having a very strange problem with the UINavigationController. I found a very similar question here:
UINavigationController not popping UINavigationBar items

但是解决方案是关于这个人已经添加了一个类别到NSMutableArray的事实,我不做什么。

but the solution there had to do with the fact that the guy had added a category to NSMutableArray, and I'm not doing anything like that.

总之,问题是:我有一个导航控制器,我推几个视图控制器。然后,当点击返回按钮时,视图控制器被弹出,但是相应的导航项不是。如果我再次点击,导航项被弹出。

In short, the problem is this: I have a navigation controller and I'm pushing a few view controllers on it. Then when the 'back' button is tapped the view controller is popped, but the corresponding navigation item isn't. If I tap back again, then the navigation item is popped.

此外,它只会发生在使用导航控制器的导航栏上的后退按钮。如果我明确调用popViewController(例如从一个按钮按),它的工作原理。

Besides, it only happens when using the back button from the navigation controller's navigation bar. If I call popViewController explicitly (for example from a button press), it works as expected.

这只发生在我的iPad运行操作系统3.2,但不是在我的iPod触摸运行的操作系统3.0或在模拟器上。

And this only happens on my iPad running OS 3.2, but not on my iPod Touch running OS 3.0 or on the simulator.

我一直在尝试将一个单独的项目中的问题与我的应用程序的其余部分,所以我可以试验它,但我不能让它重现,虽然它发生在我的应用程序中的特定视图的100%的时间。

I've been trying to isolate the problem in a separate project from the rest of my app so I can experiment with it, but I can't get it to reproduce, though it occurs 100% of the times on specific views in my app.

我知道这不是几乎足够的信息,具体的答案,但我只想知道是否有人听说过导航控制器没有按预期弹出导航项目,所以我可以有一些线索,下一步调查哪里。

I know that's not nearly enough information to get an specific answer, but I just wanted to know if anyone ever heard of a navigation controller not popping the navigation items as expected, just so I could have some clue as to where to investigate next.

下面是一个我用来推送视图控制器的代码的例子,它很简单,我不想做任何特殊的事情:

Here's an example of the code I use to push a view controller, it's pretty straightforward, I'm not trying to do anything special with it:

// pushing a view controller from a button press (set up with interface builder)
- (IBAction) tappedExtras
{
    ExtrasViewController *controller = [[ExtrasViewController alloc] initWithNibName:@"ExtrasViewController" bundle:nil];

    [self.navigationController pushViewController:controller animated:YES];

    [controller release];
}

注意:在这个例子中,我使用一个自定义视图控制器类ExtrasViewController ,但问题发生在任何类型的视图控制器我尝试。

note: in that example I'm using a custom view controller class called ExtrasViewController, but the problem happened with any kind of view controller I tried.

这里有一些代码用于显式地弹出视图控制器,也由按钮按set与界面构建器的关系:

And here's a bit of code used to pop the view controller explicitly, also triggered by a button press set up with interface builder:

- (IBAction) cancelChanges
{
    userCancelled = YES;
    [self.navigationController popViewControllerAnimated:YES];
}

这完美地工作视图控制器如果您点击导航栏上的后退按钮,而不是点击使用界面构建器设置的按钮,导航项就不会正确弹出。

this works perfectly (popping the view controller explicitly), but on the exact same view controller if instead of tapping the button set up with interface builder you tap the back button on the navigation bar, the navigation item is not popped correctly.

推荐答案

我有同样的问题导航在poping第三级推视图控制器后存在。
此问题只会在iPad上以横向显示。在iPhone上没有问题(3.1.3& 4.0)。当然,它在模拟器上确定。

I got the same issue with navigation that subsist after poping the third level pushed view controller. The issue only appear in landscape on iPad. No issue on the iPhone (3.1.3 & 4.0). Of course, it's ok on the simulator.

这篇关于UINavigationController不弹出iPad上的UINavigationBar项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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