diff --git a/XBMC Remote/DetailViewController.m b/XBMC Remote/DetailViewController.m index dff2b773b..45321f868 100644 --- a/XBMC Remote/DetailViewController.m +++ b/XBMC Remote/DetailViewController.m @@ -481,16 +481,6 @@ - (void)addExtraProperties:(NSMutableArray*)mutableProperties newParams:(NSMutab } } -- (UIViewController*)topMostController { - UIViewController *topController = UIApplication.sharedApplication.keyWindow.rootViewController; - - while (topController.presentedViewController) { - topController = topController.presentedViewController; - } - - return topController; -} - - (void)setFilternameLabel:(NSString*)labelText runFullscreenButtonCheck:(BOOL)check forceHide:(BOOL)forceHide { self.navigationItem.title = [Utilities stripBBandHTML:labelText]; if (IS_IPHONE) { @@ -3254,7 +3244,7 @@ - (void)showActionSheet:(NSIndexPath*)indexPath sheetActions:(NSArray*)sheetActi UIImageView *isRecordingImageView = (UIImageView*)[cell viewWithTag:EPG_VIEW_CELL_RECORDING_ICON]; BOOL isRecording = isRecordingImageView == nil ? NO : !isRecordingImageView.hidden; CGPoint sheetOrigin = CGPointMake(rectOriginX, rectOriginY); - UIViewController *showFromCtrl = [self topMostController]; + UIViewController *showFromCtrl = [Utilities topMostController]; [self showActionSheetOptions:title options:sheetActions recording:isRecording origin:sheetOrigin fromcontroller:showFromCtrl fromview:self.view]; } else if (indexPath != nil) { // No actions found, revert back to standard play action @@ -3284,7 +3274,7 @@ - (void)longPressSeason:(UILongPressGestureRecognizer*)sender { title = [NSString stringWithFormat:@"%@\n%@", title, season]; } - UIViewController *showFromCtrl = [self topMostController]; + UIViewController *showFromCtrl = [Utilities topMostController]; UIView *showFromView = nil; if (IS_IPHONE) { showFromView = self.view; @@ -3366,7 +3356,7 @@ - (void)handleLongPress:(UILongPressGestureRecognizer*)activeRecognizer { } UIImageView *isRecordingImageView = (UIImageView*)[cell viewWithTag:EPG_VIEW_CELL_RECORDING_ICON]; BOOL isRecording = isRecordingImageView == nil ? NO : !isRecordingImageView.hidden; - UIViewController *showFromCtrl = [self topMostController]; + UIViewController *showFromCtrl = [Utilities topMostController]; UIView *showFromView = nil; if (IS_IPHONE) { showFromView = self.view; diff --git a/XBMC Remote/MasterViewController.m b/XBMC Remote/MasterViewController.m index 670c84cdb..59c3d78cb 100644 --- a/XBMC Remote/MasterViewController.m +++ b/XBMC Remote/MasterViewController.m @@ -230,7 +230,7 @@ - (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPat - (void)addMessagesToRootView { // Add MessagesView to root view to be able to show messages on top - UIView *rootView = UIApplication.sharedApplication.keyWindow.rootViewController.view; + UIView *rootView = [Utilities topMostController].view; [rootView addSubview:messagesView]; } diff --git a/XBMC Remote/Utilities.h b/XBMC Remote/Utilities.h index 5d7b9dc5c..d73d0ef5c 100644 --- a/XBMC Remote/Utilities.h +++ b/XBMC Remote/Utilities.h @@ -123,5 +123,6 @@ typedef enum { + (void)wakeUp:(NSString*)macAddress; + (NSString*)getUrlStyleAddress:(NSString*)address; + (int)getActivePlayerID:(NSArray*)activePlayerList; ++ (UIViewController*)topMostController; @end diff --git a/XBMC Remote/Utilities.m b/XBMC Remote/Utilities.m index 20c067211..e74f17894 100644 --- a/XBMC Remote/Utilities.m +++ b/XBMC Remote/Utilities.m @@ -1435,4 +1435,12 @@ + (int)getActivePlayerID:(NSArray*)activePlayerList { return activePlayerID; } ++ (UIViewController*)topMostController { + UIViewController *topController = UIApplication.sharedApplication.keyWindow.rootViewController; + while (topController.presentedViewController) { + topController = topController.presentedViewController; + } + return topController; +} + @end