In my application I required superview's view controller, Following is code for achieving same.
id superView = [self superview];
id viewController = [superView nextResponder];
[viewController doSomeStuff];
And here is what UIResponder documentation says about nextResponder
UIView
implements this method by returning theUIViewController
object that manages it (if it has one) or its superview (if it doesn’t); UIViewController
implements the method by returning its view’s superview; UIWindow
returns the application object, and UIApplication
returns nil
.
No comments:
Post a Comment