Set the UITabBarController delegate to the UIStoryboard
I have searched for this, cannot find the answer.
I tune UIStoryboard
in Interface Builder, and as long as everything works fine, I can not seem to connect the output delegate
to UITabBarController
any of the UIViewController
in UIStoryboard
, regardless of their position in the UIStoryboard
. I installed UIViewController
as <UITabBarControllerDelegate>
in file .h
, but Interface Builder won't let me choose UIViewController
both delegate
for UITabBarController
.
Has anyone faced this problem?
It turns out the reason you can't install delegate
in UIStoryboard
is because you have no guarantee that it boots UIViewController
before downloading UITabBar
. So a software install delegate
(in another UIViewController
) is the ONLY way to accomplish this.
You need to do this programmatically in application:didFinishLaunchingWithOptions
your application delegate method :
_tabBarController = (UITabBarController *)_window.rootViewController;
_tabBarController.delegate = self;