记录:可以写成扩展
-
(UIViewController *)viewController
{
UIResponder *next = [self nextResponder];
do {
if ([next isKindOfClass:[UIViewController class]]) {
return (UIViewController *)next;
}next = [next nextResponder];
} while (next != nil);
return nil;
}