iOS寻找当前View的控制器

分类方法

  • (UIViewController )findViewController
    {
    for (UIView
    next = self; next; next = next.superview) {
    UIResponder* nextResponder = [next nextResponder];
    if ([nextResponder isKindOfClass:[UIViewController class]]) {
    return (UIViewController*)nextResponder;
    }
    }
    return nil;
    }

你可能感兴趣的:(iOS寻找当前View的控制器)