-(UIViewController *)viewController{
UIResponder *nexRes=[self nextResponder];
do {
//判读当前的响应者是否UIViewController
if ([nexRes isKindOfClass:[UIViewController class]]) {
//是否直接处理
return (UIViewController*)nexRes;
}else{
//否则继续寻找
nexRes=[nexRes nextResponder];
}
} while (nexRes!=nil);
return nil;
复制代码
}