如何隐藏tabbar顶部的黑线(swift)

前面我介绍过如何隐藏导航条底部的黑线,有时候我们还需要隐藏tabbar顶部的黑线,下面我就简单介绍一下如何隐藏tabbar顶部的黑线(swift)
看代码

self.tabBar.shadowImage = UIImage()
self.tabBar.backgroundImage = initWithImage(RGB(246, 246, 246, 0.8))

func initWithImage(color:UIColor)->UIImage{
        let rect = CGRect(x: 0,y: 0,width: 1,height: 1)
        UIGraphicsBeginImageContext(rect.size)
        let context = UIGraphicsGetCurrentContext()
        CGContextSetFillColorWithColor(context!,color.CGColor)
        CGContextFillRect(context!,rect)
        let image = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return image!
    }

你可能感兴趣的:(导航,swift,常用方法)