好吧,我有一个基于标签的应用程序,每个标签都有一个 navigationController。当我在每个 navigationController 的根目录并推送视图时,动画运行完美,但是当我在推送视图上并且我想弹出它时,navigationController 会被动画化,但视图不会。这是我用来弹出它的:
[self.navigationController popViewControllerAnimated:YES];
并推动它:
[self.navigationController pushViewController:activityController animated:YES];
有什么建议吗?
编辑:
我在根控制器中有一个 tableView。每次我选择一行时,我都会运行此代码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
ActivityViewController *activityController = [[ActivityViewController alloc] initWithNibName:@"ActivityViewController" bundle:nil];
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
[backButton setBackgroundImage:[UIImage imageNamed:@"BackButonItem"] forState:UIControlStateNormal];
[backButton setBackgroundImage:[UIImage imageNamed:@"BackButonItem_Pressed"] forState:UIControlStateHighlighted];
[backButton addTarget:self action:@selector(popBack) forControlEvents:UIControlEventTouchUpInside];
[backButton setFrame:CGRectMake(15, 10, 55, 30)];
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
activityController.navigationItem.leftBarButtonItem = backButtonItem;
activityController.navigationItem.hidesBackButton = YES;
[self.navigationController pushViewController:activityController animated:YES];
}
这是我的 popBack 方法:
- (void) popBack
{
[self.navigationController popViewControllerAnimated:YES];
}