iOS: Removing UINavigationBar animation(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 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS:删除 UINavigationBar 动画
基础教程推荐
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- Firebase 云消息传递令牌未生成 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01