From 8857fcfecb0ce7e36e939c122677e6e0cb9b6026 Mon Sep 17 00:00:00 2001 From: Stephan Diederich Date: Tue, 4 Dec 2012 00:54:37 +0100 Subject: [PATCH] fix UIActionSheet now showing in UIScrollView if the BITFeedbackListViewController's view is contained in a scrollview, the UIActionSheet if offset by the contentOffset when presented. But as the action sheet is presented in a separate window, that offset moves it out of the view. Instead, show the action sheet in the window's rootViewController's view. --- Classes/BITFeedbackListViewController.m | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Classes/BITFeedbackListViewController.m b/Classes/BITFeedbackListViewController.m index ea5fb9f4e4..6cc1bdfffa 100644 --- a/Classes/BITFeedbackListViewController.m +++ b/Classes/BITFeedbackListViewController.m @@ -255,7 +255,7 @@ ]; [deleteAction setTag:0]; [deleteAction setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; - [deleteAction showInView:self.view]; + [deleteAction showInView:[self viewForShowingActionSheetOnPhone]]; } else { UIAlertView *deleteAction = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackListButonDeleteAllMessages") message:BITHockeyLocalizedString(@"HockeyFeedbackListDeleteAllTitle") @@ -268,6 +268,18 @@ } } +- (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 { + //hope for the best. Should work + //on simple view(controller) hierarchies + return self.view; + } +} #pragma mark - BITFeedbackUserDataDelegate @@ -552,7 +564,7 @@ ]; [linkAction setTag:1]; [linkAction setActionSheetStyle:UIActionSheetStyleBlackTranslucent]; - [linkAction showInView:self.view]; + [linkAction showInView:[self viewForShowingActionSheetOnPhone]]; } else { UIAlertView *linkAction = [[UIAlertView alloc] initWithTitle:[url absoluteString] message:nil