tabBarController : didSelectViewController: doesn't get called

Discussion in 'Mac Programming' started by kselbee, May 20, 2008.

  1. kselbee macrumors newbie

    Apr 1, 2008
    I created a Cocoa Touch Tab Bar application and put some code in the tabBarController:didSelectViewController: function but it doesn't appear to get called when I switch views. Does anyone know if this is a bug or if there's something particular I need to do? Thanks...
  2. tacoman667 macrumors regular

    Mar 27, 2008
    I ran into that exact same issue. Are you sure from teh documentation that you wrote the correct method statement? Example, -(returnVal)methodName:<etc...>. If you do not use exactly the one the framework is looking for, it will not work.

    Also make sure not to prototype that method in the <.h> interface declaration, only in the <.m> implimentation declaration. If you did this and there is a warning or error at compile-time, then you will need to add the delegate into the interface declaration. For example, @interface MyClass <TabBarControllerDelegate> {}. The reason you do this is to expose all the methods that class allows to the subclass without having to actually inherit from it. This is a new Objective-C 2.0 thing I believe.
  3. kselbee thread starter macrumors newbie

    Apr 1, 2008
    Thanks for the reply. Yes, I'm sure it's right because I created a new Tab Bar application and the function is created for me... there's just no code in it. I'm guessing maybe it's a bug. Anyone know for sure?

Share This Page