//获取view的controller
- (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;
}
ios 获取当前view的controller,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/dachengzi/p/3739071.html