UIViewController *controller;
UIView *view = self.view;
while (1)
{
controller = (UIViewController *)view.nextResponder;
if (![controller isKindOfClass:[UIViewControllerclass]] || controller.navigationController == nil)
view = view.superview;
else
break;
}