ios 7从navigationViewController中删除viewController

时间:2013-10-01 12:34:05

标签: iphone objective-c uinavigationcontroller ios7 navigationbar

当我做这样的事情时:

NSMutableArray *viewControllers = [NSMutableArray arrayWithCapacity:1];
[viewControllers addObject:self];
[self.navigationController setViewControllers:viewControllers];

或者像这样

UINavigationController *nav = self.navigationViewController;
NSMutableArray *arrViewControllers = [NSMutableArray arrayWithArray:nav.viewControllers];
[arrViewControllers removeObjectAtIndex:1];
nav.viewControllers = arrViewControllers;

导航栏按钮和标题未在IOS 7上更新。因此,当用户触摸一个时,它会发生崩溃。 有办法解决这个问题吗?

在IOS 6中工作正常。

1 个答案:

答案 0 :(得分:2)

您应该使用[nav pushViewController:self animated:YES][nav popViewControllerAnimated:YES]