https://stackoverflow.com/questions/1372977/given-a-view-how-do-i-get-its-viewcontroller
Objective-C category:
@interfaceUIView(mxcl)-(UIViewController*)parentViewController;@end@implementationUIView(mxcl)-(UIViewController*)parentViewController{UIResponder*responder=self;while([responder isKindOfClass:[UIViewclass]])responder=[responder nextResponder];return(UIViewController*)responder;}@end