swift navigation bar title remove animation

2019-09-19 06:24发布

I have added Page Control to the title of navigation bar from Interface Builder. 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())

page control as title

2条回答
孤傲高冷的网名
2楼-- · 2019-09-19 06:58

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.

And switch between View Controller using Page View Controller instead of doing push/pop.

查看更多
Juvenile、少年°
3楼-- · 2019-09-19 07:20

Try

UIView.performWithoutAnimation { () -> Void in
        <#code#>
    }
查看更多
登录 后发表回答