Well, if you're using a TabBarController and a Navigation Controller, then theoretically you're having to use a ViewController to controller whatever is on the screen. That means that in almost all circumstances (the exception being threaded code), the current view controller would be.... self.

If for some strange reason that doesn't work for you, then you can register an object (like an app controller or something) to receive notifications whenever a tab bar or navigation controller changes views, then just store a pointer to whatever the topViewController or selectedViewController is.

Dave

On 6 Jan, 2009, at 9:20 PM, Tharindu Madushanka wrote:

Hi
Can I get the class type of the current view controller running in the
application, I have Tab Controller and Navigation Controller in my
application, at some time I need to get the current view controller using
code, can any body please tell me a method or code segment to do this.
isKindOfClass: can be used to test the class type. But how can I get the
current active view contrller? please help me to solve this.
Thank you,
Tharindu
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to