// 隐藏NavigationBar下面的黑线
public func hideNavBottomHairline(hide: Bool) {
let navigationBarImageView = hairlineImageViewInNavigationBar(view: self.navigationController!.navigationBar)
navigationBarImageView?.isHidden = hide
}
private func hairlineImageViewInNavigationBar(view: UIView) -> UIImageView? {
if view.isKind(of: UIImageView.self) && view.bounds.height <= 1.0 {
return (view as! UIImageView)
}
let subviews = (view.subviews as [UIView])
for subview: UIView in subviews {
if let imageView: UIImageView = hairlineImageViewInNavigationBar(view: subview) {
return imageView
}
}
return nil
}
转自:https://blog.csdn.net/same_life/article/details/126950493
网友评论