ios – 一个ContainerViewController内的UINavigationController popView的时髦

ios – 一个ContainerViewController内的UINavigationController popView的时髦,第1张

概述所以我有一个containerView Controller,它基本上就像splitViewController一样. 我试图在containerViewController中添加一个UINavigationController,它工作得很好. 我在故事板中创建了一个UINavigationController,其中连接了一堆UIViewControllers,所有这些都通过’push’segue 所以我有一个containerVIEw Controller,它基本上就像splitVIEwController一样.

我试图在containerVIEwController中添加一个UINavigationController,它工作得很好.

我在故事板中创建了一个UINavigationController,其中连接了一堆UIVIEwControllers,所有这些都通过’push’segues挂钩和链接在一起.我从故事板中取出这个NavigationController,通过代码将它粘贴在我的ContainerVIEwController中.然后它显示了NavigationController应该在哪里,我可以单击按钮,推送动画只发生在ContainerVIEwController的NavigationController框架内.

但是,如果我从NavigationController上的代码调用popVIEwController,它将为整个ContainerVIEwController设置动画.我不想要它,我想它只为NavigationController设置动画.

有谁知道它为什么这样做?

当你在ContainerVIEwController里面有一个UINavigationController,然后你就可以在NavigationController上使用popVIEwController,你如何才能使它只动画UINavigationController,而不是它所在的整个ContainerVIEwController?

解决方法 我也遇到过这个问题.这也影响了我的推动力.我的工作是使用代码而不是故事板segues.

- (voID) switchToVIEw:(Nsstring *)IDentifIEr {    UIVIEwController *target = [self getorCreateVIEwController:IDentifIEr];    [self switchToVIEwController:target IDentifIEr:IDentifIEr];}// If you need to interact with the VC before it is pushed break it into 2 step process- (UIVIEwController *) getorCreateVIEwController:(Nsstring *)IDentifIEr {    NSArray *children = [self.vIEwControllers filteredArrayUsingPredicate:[nspredicate predicateWithFormat:@"restorationIDentifIEr == %@",IDentifIEr,nil]];    UIVIEwController *target = (children.count > 0 ? children[0] : [self.storyboard instantiateVIEwControllerWithIDentifIEr:IDentifIEr]);    return target;}// For my use case,I always animate via push. Could modify this to pop/push as appropriate- (voID) switchToVIEwController:(UIVIEwController *)target IDentifIEr:(Nsstring *)IDentifIEr {    [self setVIEwControllers:[self.vIEwControllers filteredArrayUsingPredicate:[nspredicate predicateWithFormat:@"restorationIDentifIEr != %@",nil]] animated:NO];    [self pushVIEwController:target animated:YES];}

有点Fugly解决方法我知道…希望我找到一个更好的答案(到这里寻找一个). 总结

以上是内存溢出为你收集整理的ios – 一个ContainerViewController内的UINavigationController popView的时髦全部内容,希望文章能够帮你解决ios – 一个ContainerViewController内的UINavigationController popView的时髦所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/999425.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存