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!
}
}
how to remove 1px line at UINavigationBar
最新推荐文章于 2016-12-29 23:47:00 发布