美文网首页
Swift - 隐藏导航栏底部黑边

Swift - 隐藏导航栏底部黑边

作者: 我是一个大胖墩 | 来源:发表于2023-08-03 17:33 被阅读0次
    // 隐藏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

    相关文章

      网友评论

          本文标题:Swift - 隐藏导航栏底部黑边

          本文链接:https://www.haomeiwen.com/subject/xzimpdtx.html