3
votes

I have a storyboard with an initial splash view controller followed by a tabbar controller, navigation controllers, and tableview controllers. I need to present an action sheet from one of my tableview controllers.

[UIActionSheet showInView:self.view] does not work, because touches that fall in the tab bar area are not detected, so I must use [UIActionSheet showInTabBar:tabBar].

My question is how can I get a reference to the tab bar or the UITabBarController. Xcode does not allow me to connect a referencing outlet from the UITabBarController or from the UITabBar to any of my custom view controllers (presumably because view controllers on a storyboard are not static objects, but are only created when necessary and related by segues (?), so you aren't supposed to do it that way), but this leaves me with no way to get at the tab bar directly.

What is the right way to do this ?

1
Figured it out.. [self.parentViewController.parentViewController tabBar]Colin

1 Answers

1
votes

There is probably a better answer to this question over here: Storyboard - UITabBarController

In short, pull the root view controller off your appdelegate's window.

I just did the following in my viewWillAppear to hide my tab bar for that particular view:

AppDelegate *ap = (AppDelegate *)[[UIApplication sharedApplication] delegate];
UITabBarController *tc = (UITabBarController *)[[ad window] rootViewController];
[[tc tabBar] setHidden:YES];