【发布时间】:2021-09-30 14:00:35
【问题描述】:
我遇到了 NavigationBar 的问题,我不想在子视图(子视图)中使用它,我也使用 setNavigationBarHidden() 方法隐藏但它不起作用。
class VehicleSavingPopupViewController: UIViewController {
@IBOutlet weak var bottomView: UIView!
@IBOutlet weak var backGroundView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
animateView()
backGroundView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(backGroundViewTapped(_:))))
// Do any additional setup after loading the view.
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.setNavigationBarHidden(true, animated: false)
}
private func animateView(){
UIView.animate(withDuration: 0.5, delay: 0, options: [.transitionCurlDown],
animations: { [weak self] in
guard let self = `self` else {return}
self.bottomView.center.y -= self.bottomView.bounds.height
}, completion: nil)
}
【问题讨论】:
标签: swift uiviewcontroller storyboard uinavigationbar addsubview