iOS 根据view获取当前的UIViewController

//获取当前的UIViewController + (UIViewController *)currentVCWithCurrentView:(UIView *)view{ UIViewController *result = nil; for (UIView* next = [view superview]; next; next = next.superview) { UIResponder *nextResponder = [next nextResponder]; if ([nextResponder isKindOfClass:[UIViewController class]]) { return nextResponder; } } return result; }

你可能感兴趣的:(iOS 根据view获取当前的UIViewController)