I'm setting a new stack of ViewControllers to my navigationController by doing the following:
我通过执行以下操作将新的ViewControllers堆栈设置到我的navigationController:
MainMenuViewController *mainMenuViewController = [[MainMenuViewController alloc] init];
NSArray *controllerArray = [NSArray arrayWithObject:mainMenuViewController];
[mainMenuViewController release];
[self.navController setViewControllers:controllerArray animated:YES];
The only problem is I can't seem to set the transitional style. Ideally I'd like it to flip. Is this possible? It's important that I use setViewControllers:animated rather than presentModalViewController since I switch back and forth between stacks and want to maintain the navigation control behaviours for each.
唯一的问题是我似乎无法设置过渡风格。理想情况下,我希望它能够翻转。这可能吗?重要的是我使用setViewControllers:animated而不是presentModalViewController,因为我在堆栈之间来回切换,并希望维护每个堆栈的导航控制行为。
1 个解决方案
#1
0
Instead of swapping out entire navigation stacks, why not just maintain two navigation controllers and animate a transition between them? Seems cleaner to me.
而不是交换整个导航堆栈,为什么不只是维护两个导航控制器并动画它们之间的过渡?对我来说似乎更干净。
UPDATE
I guess I could be of better assistance if I knew what you were trying to achieve, but I know that you can present a second nav controller modally from a first, and you can push a bunch of views onto it before/after presentation, etc. Also, out-and-out replacement of an existing stack of view controllers, especially if it's deep, may confuse the user, not to mention the Apple review team.
如果我知道你想要实现的目标,我想我可以提供更好的帮助,但我知道你可以从第一个模拟地提供第二个导航控制器,你可以在演示之前/之后将一堆视图推到它上面等等。此外,现有的视图控制器堆栈的彻底更换,特别是如果它很深,可能会使用户感到困惑,更不用说Apple审核团队了。
Maintaining two nav controllers in memory is not necessarily a big deal, as long as you have the memory (you probably do), and as long as the user is actually getting benefit.
在内存中维护两个导航控制器并不是一件大事,只要你有内存(你可能会这样做),并且只要用户真正获益。
Perhaps you can shed some light on your high-level purpose and we can go from there.
也许你可以阐明你的高级目的,我们可以从那里开始。
MORE
If you want it to flip, then you can set navController2.modalTranstitionStyle = UIModalTransitionStyleFlipHorizontal
, which will cause navController2
to flip in when it is presented modally.
如果你想要它翻转,那么你可以设置navController2.modalTranstitionStyle = UIModalTransitionStyleFlipHorizontal,这将导致navController2在模态呈现时翻转。
SO had some weird glitch about the time we were commenting below, it might have lost your updates.
因为我们在下面评论的时间有一些奇怪的故障,它可能已经丢失了你的更新。
#1
0
Instead of swapping out entire navigation stacks, why not just maintain two navigation controllers and animate a transition between them? Seems cleaner to me.
而不是交换整个导航堆栈,为什么不只是维护两个导航控制器并动画它们之间的过渡?对我来说似乎更干净。
UPDATE
I guess I could be of better assistance if I knew what you were trying to achieve, but I know that you can present a second nav controller modally from a first, and you can push a bunch of views onto it before/after presentation, etc. Also, out-and-out replacement of an existing stack of view controllers, especially if it's deep, may confuse the user, not to mention the Apple review team.
如果我知道你想要实现的目标,我想我可以提供更好的帮助,但我知道你可以从第一个模拟地提供第二个导航控制器,你可以在演示之前/之后将一堆视图推到它上面等等。此外,现有的视图控制器堆栈的彻底更换,特别是如果它很深,可能会使用户感到困惑,更不用说Apple审核团队了。
Maintaining two nav controllers in memory is not necessarily a big deal, as long as you have the memory (you probably do), and as long as the user is actually getting benefit.
在内存中维护两个导航控制器并不是一件大事,只要你有内存(你可能会这样做),并且只要用户真正获益。
Perhaps you can shed some light on your high-level purpose and we can go from there.
也许你可以阐明你的高级目的,我们可以从那里开始。
MORE
If you want it to flip, then you can set navController2.modalTranstitionStyle = UIModalTransitionStyleFlipHorizontal
, which will cause navController2
to flip in when it is presented modally.
如果你想要它翻转,那么你可以设置navController2.modalTranstitionStyle = UIModalTransitionStyleFlipHorizontal,这将导致navController2在模态呈现时翻转。
SO had some weird glitch about the time we were commenting below, it might have lost your updates.
因为我们在下面评论的时间有一些奇怪的故障,它可能已经丢失了你的更新。