Get the current Display page in iOS appdelegate
There are many ways on the internet, but they are not good enough to find this so that they can share with you.
1-(Uiviewcontroller *) Currentviewcontroller2 {3Uiviewcontroller * CURRVC =Nil;4Uiviewcontroller * ROOTVC =Self.window.rootViewController;5 Do {6 if([ROOTVC Iskindofclass:[uinavigationcontrollerclass]]) {7Uinavigationcontroller * nav = (Uinavigationcontroller *) ROOTVC;8Uiviewcontroller * v =[Nav.viewcontrollers Lastobject];9CURRVC =v;TenROOTVC =V.presentedviewcontroller; One Continue; A}Else if([ROOTVC Iskindofclass:[uitabbarcontrollerclass]]){ -Uitabbarcontroller * TABVC = (Uitabbarcontroller *) ROOTVC; -CURRVC =TABVC; theROOTVC =[Tabvc.viewcontrollers ObjectAtIndex:tabVC.selectedIndex]; - Continue; - } - //else if ([Rootvc Iskindofclass:[xxxcustom class]]) { + //Xxxcustom * TABVC = (Xxxcustom *) ROOTVC; - //currvc = TABVC; + //ROOTVC = Tabvc.selectedviewcontroller; A //continue; at // } -} while(rootvc!=nil); - - - returnCURRVC; -}
Get the current Display page in iOS appdelegate