how to remove 1px line at UINavigationBar

来源:互联网 发布:js 中文编码 编辑:程序博客网 时间:2024/04/28 17:40
let navBar:UINavigationBar=UINavigationBar()navBar.frame=CGRectMake(0, 0, view.frame.width, 80)navBar.shadowImage = UIColor.whiteColor().as1ptImage()navBar.setBackgroundImage(UIColor.whiteColor().as1ptImage(), forBarMetrics: UIBarMetrics.Default)extension UIColor {    func as1ptImage() -> UIImage {        UIGraphicsBeginImageContext(CGSizeMake(1, 1))        let ctx = UIGraphicsGetCurrentContext()        self.setFill()        CGContextFillRect(ctx!, CGRect(x: 0, y: 0, width: 1, height: 1))        let image = UIGraphicsGetImageFromCurrentImageContext()        UIGraphicsEndImageContext()        return image!    }}
0 0