• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to get the current view controller in iPhone application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the current view controller in iPhone application


  • Subject: Re: How to get the current view controller in iPhone application
  • From: Dave DeLong <email@hidden>
  • Date: Tue, 06 Jan 2009 21:26:51 -0700

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@hidden)

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:
This email sent to email@hidden


References: 
 >How to get the current view controller in iPhone application (From: "Tharindu Madushanka" <email@hidden>)

  • Prev by Date: Re: Binary search on sorted NSArray in Cocoa?
  • Next by Date: Re: Programatically locking user screen
  • Previous by thread: How to get the current view controller in iPhone application
  • Next by thread: Re: Programatically locking user screen
  • Index(es):
    • Date
    • Thread