My UITabBarController's didSelectViewController method is not getting called?

Here is my code stub for my app-delegate.m -- it never gets called.

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
    NSLog(@"%s", __FUNCTION__);

It is defined in this app-delegate.h

@interface OrioleAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> {
    UIWindow *window;
    UITabBarController *tabBarController;

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UITabBarController *tabBarController;



Did you make a connection between your UITabBarController and your application delegate?

- (void)applicationDidFinishLaunching:(UIApplication *)application
     tabBarController.delegate = self;

If your ViewController is a UITabBarController, you need to set self as it's delegate because you can't change the delegate of the UITabBar directly.

For example, in the ViewDidLoad of your UITabBarController :

- (void)viewDidLoad
    [super viewDidLoad];
    self.delegate = self;

I added the following tabBarController.delegate = self; and all is well. I hope this is helpful to others.

- (void)applicationDidFinishLaunching:(UIApplication *)application {

    // Add the tab bar controller's current view as a subview of the window
    tabBarController.delegate = self;
    [window addSubview:tabBarController.view];

Need Your Help

Dynamic Code Evolution Vm - For Ejb Jar Deployment

jboss ejb dcevm

I'm working on EJB 3.0 with Jboss 6.1 at the moment. All the time after I change someshing in EJB modules (server side) I have to export JAR file to /jboss-6.1.0.Final/server/default/deploy

undefined reference to 'myNamespace::MyClass::myFunc()'

c++ dll linker eclipse-cdt

I am having a problem calling functions from my test_dll.dll in an outside c++ main. Working on eclipse cdt luna sr2 64, Windows 7. Using the MinGW toolchain for compilation.