gpt4 book ai didi

iphone - UINavigationController 未按需要设置动画

转载 作者:行者123 更新时间:2023-12-03 20:15:27 25 4
gpt4 key购买 nike

嗯,我有一个基于选项卡的应用程序,每个选项卡都有一个导航 Controller 。当我位于每个 navigationController 的根目录并推送 View 时,动画运行完美,但是当我处于推送 View 并且想要弹出它时,navigationController 会动画化,但 View 不会动画化。这就是我用来弹出它的方法:

[self.navigationController popViewControllerAnimated:YES];

并插入它:

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

有什么建议吗?

编辑:

我在根 Controller 中有一个 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];
}

最佳答案

你尝试过

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

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

关于iphone - UINavigationController 未按需要设置动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10370977/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com