Sunday, 11 August 2013

Set UITabBarController created in Interface Builder as delegate

Set UITabBarController created in Interface Builder as delegate

I created my iOS app with Tab Bar template, so here is UITabBarController
with bar buttons. An issue is how to set it as delegate. I found at SO
that it has to be set programmatically in AppDelegate, but I believe it's
impossible, because I've got no access to Tab Bar Controller as outlet.
I added proper value to @interface (both ViewController and AppDelegate),
but doesn't know what to do next.
@interface ViewController : UIViewController <UITabBarControllerDelegate>
I hope I don't have to get rid of whole app template and it's possible to
set Tab Bar Controller created in IB to be delegate.
Exactly I want to make it delegate to create on tab select event like this:
- (void)tabBarController:(UITabBarController *)tabBarController
didSelectViewController:(UIViewController *)viewController;
Any idea?

No comments:

Post a Comment