I have a tab bar with 4 buttons ("Home", "Visits", "Share", "More"). I want the Share button on my tab bar to call up an action sheet that has corresponding buttons for selecting the channels that I want the user to be able to distribute links to the application (Facebook, Twitter, email, etc.).
I can do this using the Storyboard, but I need to create a unique (empty) view controller that is connected to the Share button on the tab bar. I put the following code in the viewDidAppear method to display the action sheet when the Share button is selected:
int selectedTab = self.tabBarController.selectedIndex; if (selectedTab == 2) { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Share Your Visit with Friends!" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Facebook", @"Twitter", @"Email eduLaunchpad", nil]; [actionSheet showFromTabBar:self.tabBarController.tabBar]; }
When I close the worksheet, I return to the default home view:
[self.tabBarController setSelectedIndex:0]
While this works, it is not optimal from the point of view of the user. I would prefer the action sheet to appear above the specific view that was shown when the Share button was selected. For example, if the user was in the Visits view and selected Share on the tab bar, I would like the action sheet to appear at the top of the visits window, and this view would be visible behind the action sheet.
Is it possible to achieve this with a storyboard? Or do I need a custom tab bar to implement this feature? If a custom tab bar is required, I would like some guidance / insight on how to implement this, including a custom tab bar, as well as an action table from the tab bar.
Thanks in advance!