gpt4 book ai didi

objective-c - popToRootViewController 前进动画

转载 作者:行者123 更新时间:2023-12-01 18:32:02 24 4
gpt4 key购买 nike

在我的库中,我有一个加载 View ,它会弹出到输入 View 。当用户完成输入 View 时,它应该返回加载 View 再次执行一些魔术,完成后它应该显示第三个 View 。

现在,从可用性 View 来看,我不想“滑回”到加载 View ,也不想在内存中已有加载 View 时分配新的加载 View 。

有什么方法可以在向前滑动 View 时弹出ToRootViewController?
(是的,我删除了加载 View 中的后退按钮)..

最佳答案

好的 - 也许尝试使用这样的东西

// This goes in whatever view controller you want to pop with
- (void)popToRootWithForwardAnimation
{
NSMutableArray * viewControllers = [[[self.navigationController viewControllers] mutableCopy] autorelease]
UIViewController * rootViewController = [viewControllers objectAtIndex:0]
[viewControllers removeObjectAtIndex:0]; // try using with and without this line?
[viewControllers addObject:rootViewController];

[self.navigationController setViewControllers:viewControllers animated:YES];
}

// This goes in the root view controller
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated]
NSMutableArray * viewControllers = [[[self.navigationController viewControllers] mutableCopy] autorelease]
if ([viewControllers count] > 1)
{
[viewControllers removeAllObjects];
[viewControllers addObject:self];

[self.navigationController setViewControllers:viewControllers animated:NO];
}



}

关于objective-c - popToRootViewController 前进动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7876048/

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