【发布时间】:2017-08-23 19:21:30
【问题描述】:
我正在通过嵌入在 UINavigationController 中的 UIPageViewController 子类(称为 GalleryController)来实现照片库。点击时导航栏隐藏,但动画很奇怪:
https://www.youtube.com/watch?v=9SLF3Nq3uNE
GalleryController 中的代码如下:
override var navigationItem: UINavigationItem {
let item = super.navigationItem
// Access super and add items to it.
// Don't create a new UINavigationItem instance — that breaks the back button.
let space = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
space.width = touchSize / 2
item.rightBarButtonItems = [
UIBarButtonItem(title: "All Photos", style: .plain, target: self, action: #selector(showAllPhotos)),
space,
UIBarButtonItem(title: "Delete", style: .plain, target: self, action: #selector(deletePhoto))
]
return item
}
这个问题是在引入页面视图控制器之后才开始出现的。
这是什么原因造成的,我该如何解决?
【问题讨论】:
-
但您的代码与隐藏动画无关
-
我遇到了类似(但不一样)的问题,this 工作。检查您的 viewWillAppear()。覆盖 func viewWillAppear(_ animated: Bool) {;super.viewWillAppear(animated);navigationController?.setNavigationBarHidden(true, animated: animated);self.navigationItem.hidesBackButton = true;}
-
@Anbu.Karthik 隐藏动画由导航控制器显示。我只是展示了如何配置导航栏,以防它们相关。
-
好吧,我们成功了
-
什么意思?
标签: ios animation uinavigationcontroller uinavigationbar uipageviewcontroller