2017-04-12 6 views
0

私はタブバーのボーダーのため、この怒鳴るコードを適用していIOS:??セットタブバー上の境界のみ

self.tabBarController .tabBar.layer.borderWidth = 0.8 self.tabBarController .tabBar.layer.borderColor = self.tabBarController?.tabBar.tintColor.cgColor

が、このコードの境界線を使用してmy tabbar that show tabbar border all side (top,left,right,bottom)i want tabbar like this sample image that show border only at top side 今私は何をしなければならないすべての側面に適用され、私はタブバーの国境だけ上側をしたいですか?それはこのようになります おかげ

+0

それは私の質問に関連していない私は私の質問の答えを見つけカント@Lalitkumar – hardik

答えて

1
//First, remove the default top line and background 
UITabBar.appearance().shadowImage = UIImage() 
UITabBar.appearance().backgroundImage = UIImage() 

//Then, add the custom top line view with custom color. And set the default background color of tabbar  
let lineView = UIView(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 1)) 
lineView.backgroundColor = UIColor.red 
self.tabBarController?.tabBar.addSubview(lineView) 
self.tabBarController?.tabBar.backgroundColor = UIColor.init(colorLiteralRed: 248.0/255.0, green: 248.0/255.0, blue: 248.0/255.0, alpha: 1.0) 

enter image description here

関連する問題