简体   繁体   中英

TabBar's background color gets change on tab selection

I don't know why this is happening, I checked it on my storyboard, for my code, I've searched similar questions but didn't find anything.

In my tabBar I have 4 tabs, when I selecting tab #2 tabBars background color gets darken but when I select any other tab it works fine. See the image for better understanding.

tab1 selected 在此输入图像描述

tab2 selected (and the background color also get changed

在此输入图像描述 tab3 selected , and now background color gets normal

在此输入图像描述

I think that you are setting tab bar color when presenting 2nd Tab. So remove the background color in the second tab. If you can't still find that try to reset the color when view the tab :-

override func viewWillAppear(animated: Bool) {
    self.tabBarController?.tabBar.backgroundColor = UIColor.clearColor()
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM