Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the top border of my UITabBar?

Tags:

I'd like the UITabBar to have a top border of width 5.0. The border should be yellow color. I don't want any left/bottom/right borders.

The Tab Bar border should be flat (no shadows or anything like that).

How can I remove shadow (image) line?

like image 989
TIMEX Avatar asked Sep 01 '15 05:09

TIMEX


2 Answers

You can hide the top border this way in your FirstViewController.swift:

self.tabBarController!.tabBar.layer.borderWidth = 0.50 self.tabBarController!.tabBar.layer.borderColor = UIColor.clear.cgColor self.tabBarController?.tabBar.clipsToBounds = true 

And result will be:

Before:

before - top border is visible

After:

after - top border is not visible

Hope it helps.

EDIT:

You can set background image this way:

UITabBar.appearance().backgroundImage = UIImage(named: "yourImageWithTopYellowBorder.png") 
like image 168
Dharmesh Kheni Avatar answered Sep 21 '22 12:09

Dharmesh Kheni


If you want to completely remove tab bar, put this in your AppDelegate:

UITabBar.appearance().shadowImage = UIImage() UITabBar.appearance().backgroundImage = UIImage() 
like image 30
James Avatar answered Sep 20 '22 12:09

James