当推送新的 viewController 时,TabBar 总是向左动画

发布于 2024-11-26 20:09:06 字数 767 浏览 2 评论 0原文

我有一个选项卡栏应用程序,其中一个选项卡上带有导航控制器。

我想推送一个新的视图控制器,但让它从左侧开始动画。

我所拥有的是这样的:

CATransition *transition = [CATransition animation];
transition.duration = 0.8;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
transition.delegate = self;        

controller.hidesBottomBarWhenPushed = YES;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:controller animated:YES];

一切都从左侧推入,除了选项卡栏,它总是滑出到左侧(并且transition.duration对此也没有影响)。

有没有办法让taBar向同一方向滑出&与其他视图的速度?

(我也尝试过使用pushModalViewController,但它有各种图形故障)。

I have a Tab Bar app with a navigation controller on one tab.

I want to push a new view controller, but have it animate in from the left.

What I have is this:

CATransition *transition = [CATransition animation];
transition.duration = 0.8;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionPush;
transition.subtype = kCATransitionFromLeft;
transition.delegate = self;        

controller.hidesBottomBarWhenPushed = YES;
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:controller animated:YES];

Everything pushes in from the left, except for the tab bar, which always slides out to the left (and transition.duration has no effect on that either).

Is there a way to get the taBar to slide out in the same direction & speed with the rest of the view?

(I've also tried using pushModalViewController, but that has various graphical glitches instead).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云淡月浅 2024-12-03 20:09:06

在我看来,您试图在代码中仅对 self.navigationController 进行动画处理;由于 UITabBar 位于它的外部,因此它不会按照您喜欢的方式进行动画处理似乎是合理的(我认为它仅作为内部视图动画化的后续效果而进行动画处理,但您无法控制它)。

我想做的是访问您的 UITabBarControllerview 并向其 CALayer 添加动画(或者专门为此,您可以尝试不同的可能性)。

It seems to me that you are trying to animate only self.navigationController in your code; since the UITabBar is outside of it, it seems reasonable that it does not get animated as you like (I think it gets animated only as an after effect of animating the inner view, but you have no control on it).

What I would try to do is accessing your UITabBarController's view and add an animation to its CALayer as well (or exclusively to that, you can try different possibilities).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文