Search code examples
ioshideuitabbar

Unable to click "under" a hidden TabBar


I hide my tab bar like so:

self.tabBarController.tabBar.hidden = YES;

And because now there is a black bar where it once stood I stretch the view which is a UIWebView on top(or is it under?) that empty space. The UIWebView is in a UIViewController. I do that with a constraint which by default is like so:

enter image description here

The code for the constraint:

if(self.tabBarController.tabBar.hidden){
    self.webviewBottomConstrain.constant = -self.tabBarController.tabBar.frame.size.height;
}else{
    self.webviewBottomConstrain.constant = 0;
}

However if I tap the device on the place where the TabBar was it will not execute. It is as if there is something invisible there with the size of the tab bar. I have also tried hiding it the way this thread sugests. Still the same result.

Update: It seems that when you tap on the invisible tab bar the tap is recognized by the tab bar and not by the view that is visible under the tab bar


Solution

  • self.extendedLayoutIncludesOpaqueBars = YES; this will solve you problem