//获取view的controller
- (UIViewController*)viewController{
for(UIView* next = [selfsuperview]; next; next = next.superview) {
UIResponder *nextResponder = [next nextResponder];
if([nextResponder isKindOfClass:[UIViewControllerclass]]) {
return(UIViewController*)nextResponder;
}
}
returnnil;
}