- -(Uiviewcontroller *) GETCURRENTVC
- {
- Uiviewcontroller *result = nil;
- UIWindow * window = [[uiapplication sharedapplication] Keywindow];
- if (Window. windowlevel! = uiwindowlevelnormal)
- {
- Nsarray *windows = [[uiapplication sharedapplication] windows];
- For (UIWindow * tmpwin in Windows)
- {
- if (Tmpwin. Windowlevel = = uiwindowlevelnormal)
- {
- window = Tmpwin;
- Break ;
- }
- }
- }
- UIView *frontview = [[Window subviews] Objectatindex:0];
- id nextresponder = [frontview nextresponder];
- if ([Nextresponder Iskindofclass:[uiviewcontroller class]])
- result = Nextresponder;
- Else
- result = Window. Rootviewcontroller;
- return result;
- }
- -(Uiviewcontroller *) Getpresentedviewcontroller
- {
- Uiviewcontroller *APPROOTVC = [uiapplication sharedapplication]. Keywindow. Rootviewcontroller;
- Uiviewcontroller *TOPVC = APPROOTVC;
- if (TOPVC. Presentedviewcontroller) {
- TOPVC = Topvc. Presentedviewcontroller;
- }
- return TOPVC;
- }
IOS gets the currently displayed page