最近在寫項(xiàng)目的時(shí)候需要重新定義導(dǎo)航欄.所以隱藏了系統(tǒng)自帶的導(dǎo)航欄,啪啪啪,就是一通干
let containerVC = AppNavigationController(rootViewController: rootVC)
containerVC.navigationBar.isHidden = true
想不到的是控制器的側(cè)滑失效了
黑人問號(hào)
先上解決方案.
重新定義導(dǎo)航欄控制器,并在初始化方法里面隱藏系統(tǒng)導(dǎo)航欄:like
class AppNavigationController: UINavigationController {
override init(rootViewController: UIViewController) {
super.init(rootViewController: rootViewController)
self.navigationBar.isHidden = true
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
網(wǎng)上也有一些解決方案,只要加上這句代碼
containerVC.interactivePopGestureRecognizer?.delegate = self