简体   繁体   English

快速导航栏标题删除动画

[英]swift navigation bar title remove animation

I have added Page Control to the title of navigation bar from Interface Builder. 我已经从Interface Builder将Page Control添加到导航栏的标题中。 When the view push/pop to the next view, the Page Control animates (as how normally title would animate). 当视图推入/弹出到下一个视图时,页面控件会设置动画(如标题的正常动画设置)。

How do i prevent the Page Control from animating? 如何防止页面控件动画化?

I have something like this but it didn't work: 我有这样的东西,但没有用:

self.navigationItem.titleView?.removeMotionEffect(UIMotionEffect())

页面控件作为标题

Solved it. 解决了。 I need to create a new Page View Controller to manipulate the Page Control that I have placed on the navigation bar. 我需要创建一个新的页面视图控制器来操纵放置在导航栏上的页面控件。

Instead of having multiple Page Control on each View Controller, I just have one Page Control on the first page. 而不是在每个View Controller上具有多个页面控件,而在第一页上只有一个页面控件。

And switch between View Controller using Page View Controller instead of doing push/pop. 并使用Page View Controller而不是执行push / pop在View Controller之间切换。

Try 尝试

UIView.performWithoutAnimation { () -> Void in
        <#code#>
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM