ios 通过当前view得到所在的viewcontroller

@implementation UIView (GetVCAdditions)

  • (UIViewController *)GetiewController {
    Class vcc = [UIViewController class];
    UIResponder *responder = self;
    while ((responder = [responder nextResponder]))
    if ([responder isKindOfClass: vcc])
    return (UIViewController *)responder;
    return nil;
    }

你可能感兴趣的:(ios 通过当前view得到所在的viewcontroller)