1 @implementation UIView (GetVCAdditions) 2 3 - (UIViewController *)GetiewController { 4 Class vcc = [UIViewController class]; 5 UIResponder *responder = self; 6 while ((responder = [responder nextResponder])) 7 if ([responder isKindOfClass: vcc]) 8 return (UIViewController *)responder; 9 return nil; 10 }
时间: 2024-10-09 17:48:45