I use a TabBarController on my app, in one of the main views (aViewController) i push another controller (bViewController), and hide the TabBar using self.tabBarController.tabBar.hidden=YES;
bViewController have a button at the same place where the tabBar was, and it doesn't catch the touch event.
I have tried placing the button in different places of bViewController, and the area where the tabBar was supposed to be is the only place where touch event is not detected.
I have tried using bViewController outside the tabBarController and it works fine. Any help would be appreciated.
EDIT:
When i press a button on aViewController i call
self.tabBarController.tabBar.hidden=YES;
[self performSegueWithIdentifier:@"aViewToBView" sender:self];
aViewToBview is a push segue declared on storyboard
For some reason you cannot touch the views underneath the tab bar.
However, if you hide the tab bar and then add a subview to it, the view can then receive user interaction!
This worked for me:
// Create a button that is at the very bottom of the screen
CGFloat buttonHeight = 45.0f;
UIButton *finishButton = [[UIButton alloc] initWithFrame:CGRectMake(
0,
self.view.frame.size.height - self.tabBarController.tabBar.frame.size.height - buttonHeight,
self.view.frame.size.width,
buttonHeight)];
//...more initialization of the button...
//Here is our solution:
[self.tabBarController.view addSubview:finishButton];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With