调用底层的viewController--返回底层

时间:2020-12-10 21:34:59
//返回底层viewController的方法--
- (UIViewController*)GetViewController:(UIView*)uView
{
for (UIView* next = [uView superview]; next; next = next.superview) {
UIResponder* nextResponder = [next nextResponder];
if ([nextResponder isKindOfClass:[UIViewController class]]) {
return (UIViewController*)nextResponder;
}
}
return nil;
}
//调用示例--
[[self GetViewController:self.parentViewController.view] presentViewController:detailPAGE animated:YES completion:nil];