找出最近控制器

继承UIResponder 类有:

1 AppDelegate 

2 UIApplication

3 UIViewController

4 UIView

 superView 取出来的类只是 [UIView class];

通过superView 在取一次Responder很有可能控制器,具体视文件结构来定


-(UIViewController* )nextControll{

for(UIView*view = [self superview];view ;[view superview]){

UIResponder*responder = [view nextResponder];

if( [responderisKindOfClass:[UIViewControllerclass]]) {

UIViewController* Vc= (UIViewController*)responder;

returnVc;

}

}

returnnil;

}

你可能感兴趣的:(找出最近控制器)