UINavigationController没有按照想要的动画

时间:2012-04-29 09:07:52

标签: iphone objective-c animation uinavigationcontroller

好吧,我有一个基于标签的应用程序,每个标签都有一个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];
}

1 个答案:

答案 0 :(得分:0)

你试过

吗?
[self.navigationController popToViewController:self animated:YES];

它似乎解决了很多人的问题。