iOS 隐藏navigationBar下面那条线
通过View hierarchy看出,UINavigationBar上面有两个子视图,其中一个是_UINavigationBarBackground,那一条线就隐藏在_UINavigationBarBackground的子视图里面!所以在自定义的UINavigationController上面,把这个ImageView移除掉。
代码块
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
if let navigationBackground = self.navigationBar.subviews.first {
//移除navigationbar那条线
navigationBackground.subviews.first?.removeFromSuperview()
//添加你想要的view
}
}