- (UIViewController*)viewController {
for (UIView* next = [self superview]; next; next = next.superview) {
UIResponder *nextResponder = [next nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]]) {
return (UIViewController*)nextResponder;
}
}
return nil;
}
得到一个view 所在的控制器(viewController),布布扣,bubuko.com
得到一个view 所在的控制器(viewController)
原文地址:http://www.cnblogs.com/d2688/p/3773090.html