ios 获取当前view的controller
时间:2014-05-21 23:38:35
收藏:0
阅读:1000
//获取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;
}
评论(0)