获取当前View所在的ViewController 发表于 2017-04-20 获取当前view所在的viewController 12345678910- (UIViewController*)viewController{ for (UIView* next = [self superview]; next; next = next.superview) { UIResponder* nextResponder = [next nextResponder]; if ([nextResponder isKindOfClass:[UIViewController class]]) { return (UIViewController*)nextResponder; } } return nil;}