简体   繁体   中英

iOS - tab bar turns transparent after dismissing view controller

I have encountered a strange behaviour when using the tab bar controller in iOS. I have such a controller with 3 tabs, as can be seen on the following image:

标签栏

The following problem only occurs on a physical device, not on the simulator: When I present a view controller (modal) on top and dismiss it again, the tab bar turns fully transparent (not translucent) if and only if it was presented while the map tab was active. If the list or settings tab is active when the view controller is presented, then everything stays as it's supposed to be after dismissing that view controller again.

Has anybody encountered a similar behaviour? Is it a bug? Or am I doing something wrong?

Thank you for your help.

Is this only on iPhone 4? I have had a similar bug only on 4s. There is a fix for it if that is the issue. It's an apple bug. Try in viewDidAppear in the tab controller.

- (void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];

//Stupid fix for iPhone 4 Tab bar background becoming invisible
    self.tabBar.translucent = NO;
    self.tabBar.translucent = YES;


}

This worked for me to fix the background disappearing on a translucent tab bar when on iPhone 4

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