找到当前视图的父视图控制器
//找到当前视图的父视图控制器
- (UIViewController *)getViewController
{
for (UIView *next = [self superview];next;next = [next superview]) {
UIResponder *responder = [next nextResponder];
if ([responder isKindOfClass:[UIViewController class]]) {
return (UIViewController *)responder;
}
}
returnnil;
}