uiview获取所在控制器对象

uiview获取所在控制器对象

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

你可能感兴趣的:(uiview获取所在控制器对象)