I am developing an iPhone app that displays several views, all acessed via Tab Bar items. However I need to add an additional item to the Tab Bar that simply launches a URL in Safari.
I've accomplished this by adding an empty placeholder view to the TabBar and returning FALSE from shouldSelectViewController when the this view's tabBarItem is clicked on, and launching Safari at the same time.
That code is:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
if([[viewController tabBarItem] title] == "Website"){
//... launch Safari
return FALSE;
} else {
return TRUE;
}
}
PROBLEM: If the TabBar has too many items, and this "Safari Launch" tab is pushed off to the "More" navigation controller, I lose the capability to intercept the event and prevent the view from loading when clicked.
Any suggested tips?