方案一:
导航栏的底部有一根1px的横线作为导航和其他内容的分隔,多数时候我们是不会刻意去隐藏它的,某些特殊的时候需要的话可以这么做
导航栏下方的横线// 找到导航栏下的横线
private func findHairlineImageViewUnder(view: UIView) -> (UIImageView?){
if let view = view as? UIImageView,view.frame.size.height <= 1.0 {
return view
}
for subView in view.subviews {
if let lineView = findHairlineImageViewUnder(view: subView){
return lineView
}
}
return nil
}
方案二:
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
网友评论