2
votes

Background and Aim:

In my existing app, I'm trying to provide voice messaging feature to user. The idea is to optionally provide universal access of voice messaging from anywhere in the app to the user (inspired by facebook messages). I have had partial success so far in displaying my mini message dashboard and tap on which opens customized message (popover) view on both iPhone & iPad.

I added my mini dashboard subview on application keywindow and hence it's visible across (top of) all the views when navigating within the app.

[application.keyWindow addSubview:self.messageDashBoardVC.view];

This made it appear automatically (out of the box) on top of even the modal dialogs (mostly) in app presented like this..

[self presentViewController:modelVC animated:YES completion:nil]

Specific PROBLEM statement:

However.. On iPad when a view controller is presented modally with

modalPresentationStyle = UIModalPresentationFormSheet

or UIModalPresentationPageSheet the mini dashboard hides behind the modal dialog (sheet). HOWEVER, I want user to access voice feature (mini dashboard & popover views) when working on these sheets.

My existing app uses a lot of such modal dialogs (sheets).

General Problem statement: Is there any reusable component/source code available that does same thing because I think the orientation handling will also be a tricky/quite a work with my approach? Any other problem that you envisage with my approach?

2

2 Answers

2
votes

I found some success to specific PROBLEM statement above:-

The modal view is presented (added) to the same window so I simply brought my mini dashboard view in front like this..

UIWindow *appDelegateWindow = [[[UIApplication sharedApplication] delegate] window];

UIView *miniView = (UIView *)[appDelegateWindow viewWithTag:12221]; // 12221 is tag of mini dashboard view.

[appDelegateWindow bringSubviewToFront:miniView];

However, I'm still looking forward to your expert opinion about my approach and open for alternative approach considering orientation and other potential challenges I might get with this approach.

Next up - I am working on bringing my custom popover view in front of modal sheet. As of now, tap on mini view opens the message popover but behind the modal sheet.

0
votes

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

MALoginViewController *login=[[MALoginViewController alloc]initWithNibName:@"MALoginViewController" bundle:nil];
 MANowPlayingViewController *nav=[[MANavigationController alloc]initWithRootViewController:home];
[self.window setRootViewController:nav];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];

here MANowPlayingViewController is class of UINavigationController..so you have to create separate class for UINavigationController...then set that into Window RootviewController..

whatever you give in that UINavigationController class will display all pages in your app..you can handle your all common codes inside this class..For example if you add UIButton on that NavigationBar ,it will display in all classes...

thanks..