iOS:删除 UINavigationBar 动画 [英] iOS: Removing UINavigationBar animation

查看:16
本文介绍了iOS:删除 UINavigationBar 动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的应用有一个 UINavigationBar,上面有一张图片.当我们继续(推送)到另一个屏幕然后单击后退按钮时,导航栏上的图像似乎在重新出现时从左到右进行动画处理.这有点让人分心.你怎么能删除这个后退按钮动画?

我们尝试更改 segue 动画设置,但这会更改推送动画而不是返回动画.

我们的导航条码:

 让 logoImage:UIImage = UIImage(named: "ABC")!viewController.navigationItem.titleView = UIImageView(图片: logoImage)

解决方案

很大程度上是由于这个答案

请注意,我没有像链接的答案那样覆盖 NavigationController popViewControllerAnimated.

Our app has an UINavigationBar with an image on it. When we segue (push) to another screen then click the back button the image on the Navigation Bar seems to animate from left to right as it reappears. This is a little distracting. How can you remove this back button animation?

We tried changing the segue Animates setting but this changes both the push animation and not the back animation.

Our Nav Bar code:

    let logoImage:UIImage = UIImage(named: "ABC")!
    viewController.navigationItem.titleView = UIImageView(image: logoImage)

解决方案

Figured this out in large part due to this answer https://stackoverflow.com/a/8602982/47281

Create a custom Nav Bar and override popItem:

class MyNavigationBar: UINavigationBar {
    override func popItem(animated: Bool) -> UINavigationItem? {
        return super.popItem(animated: false)
    }
}

Entered MyNavigationBar as the Navigation Bar class for our Navigation Controller via the Storyboard:

Note I did not override NavigationController popViewControllerAnimated as in the linked answer.

这篇关于iOS:删除 UINavigationBar 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆