Is their any Possibilty to Check which viewController is running in IPhone application Programmatically in Appdelegate
Is their any Possibilty to Check which viewController is running in IPhone application Programmatically
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no easy answer to this. You need to walk the view controller hierarchy starting with the main window’s root view controller. If you encounter a
UINavigationControlleryou need to look at thetopViewController. Once you get to aUIViewController, you need to look at themodalViewController, if any. If you have any tab bar controllers then you need to look at the currently selected tab.Things like
UISplitViewControllercomplicates things since this can show two view controllers at once.Here is the start of a category method you could add to
UIViewController. This only handles regular view controllers and navigation controllers.Call this from your app delegate on the key window’s
rootViewController.