Bugku CTF Web (Question 10-15)

2022-12-28   ES  

When we want to show a view at any time in a non -view class, we need to add the displayed view to the sub -view of the current View, or use the current View PresentViewController, or PushViewContrller. These operations need to obtain the currently displayed ViewController.

// Get the ViewController displayed by the current screen 
 - (UIViewController *) getcurrentvc 
 {{ 
     UIViewController *result = nil; 
      
     UiWindow * Window = [[UIApplication SharedApplication] keywindow]; 
     if (Window.WindowLevel! = UIWINDOWLEVELNOLMAL) 
     {{ 
         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; 
 }

source

Related Posts

React-PARTICLE-JS particle effects realized, browser report error issues

SUBLIME Text formatting JSON-PRETTY JSON

SQLDIAG-Configuration File-Extension

Thinkcmf any file to write vulnerabilities —- Learning records

Bugku CTF Web (Question 10-15)

Random Posts

SAP-Abap Learning Record (2)

FLINK SQL Client Register Python UDF Full Process

Big Data CDH Cluster Construction

MySQL8.0.26 Installation Tutorial (Super Simple)

Quartz Deploy Table ‘HeartBeat.qrtzLocks’ DOESN’T Exist