From 2de6ed5e8c3935ba60ac1a18472ab7c3f0ec2b82 Mon Sep 17 00:00:00 2001 From: Stephan Diederich Date: Tue, 4 Dec 2012 01:43:10 +0100 Subject: [PATCH] fix UIActionSheet rotation when presented modally if the BITFeedbackListViewController is presented modally (via a UINavigationController) the action sheet should show in that view. Basically search for the root- or topmost presented view controller. --- Classes/BITFeedbackListViewController.m | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Classes/BITFeedbackListViewController.m b/Classes/BITFeedbackListViewController.m index 6cc1bdfffa..a8e42032ec 100644 --- a/Classes/BITFeedbackListViewController.m +++ b/Classes/BITFeedbackListViewController.m @@ -269,16 +269,21 @@ } - (UIView*) viewForShowingActionSheetOnPhone { - if(self.view.window.rootViewController) { - //try to show it in the rootviewcontroller's view - //so it covers the UITabBar or works if this - //controller is inside a UIScrollView - return self.view.window.rootViewController.view; - } else { + //find the topmost presented viewcontroller + //and use its view + UIViewController* topMostPresentedViewController = self.view.window.rootViewController; + while(topMostPresentedViewController.presentedViewController) { + topMostPresentedViewController = topMostPresentedViewController.presentedViewController; + } + UIView* view = topMostPresentedViewController.view; + + if(nil == view) { //hope for the best. Should work //on simple view(controller) hierarchies - return self.view; + view = self.view; } + + return view; } #pragma mark - BITFeedbackUserDataDelegate