3

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:

Tab bar

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.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
bweber
  • 3,772
  • 3
  • 32
  • 57
  • How are you presenting the VC? Are you presenting from the tab controller itself using [self.tabBarController presentViewController:vc animated:YES] ? – valheru Jun 30 '14 at 15:44

1 Answers1

4

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

Alex Reynolds
  • 6,264
  • 4
  • 26
  • 42
  • Thanks, this works as a workaround. Unfortunately one can still see that the tab bar gets transparent and than back to normal, but I guess there is no other way. Calling this in the viewWillLoad apparently doesn't help. – bweber Jul 01 '14 at 15:31
  • Nope has to be in viewDidAppear. It's an apple bug since transparency and iPhone 4 don't mix well. I could not find a real solution anywhere. Better fixed and odd than totally screwed. – Alex Reynolds Jul 01 '14 at 16:19
  • If there is no tab controller view controller, where would you put this? –  Nov 13 '15 at 15:17