May be this will return what you want to get:
id mainViewController = [self.view.superview nextResponder];
Apple's documentation of -[UIResponder nextResponder]:
UIView implements this method by returning the UIViewController object that manages it (if it has one) or its superview (if it doesn’t)
Other than this you can have idea from here.