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?
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.
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..
Related
I have iOS 6 app and I'd like to add one more ViewController (storyboard) in which it would be augmented reality. Now, I'm using Mixare, and I could start AR, but cannot exit the view.
I used this tutorial for implementation Mixare as library into my project.
I think that problem is that I'm calling MixareAppDelegate
MixareAppDelegate *delegate = [[MixareAppDelegate alloc] init];
[delegate runApplication];
that uses self.window.rootViewController
self.window.rootViewController = augViewController;
After that, I can close view, but app freezes. Is there anywhere tutorial how to call Mixare as one view in storyboard with navigation?
Is there easy way to call MixareAppDelegate which is a ViewController as viewController not as element in window.rootViewController?
You can only interact with one window at a time.
When you have added the MixareAppDelegate's window then previous window get invisible for further interaction. You have to visible previous window again.
try:
[window makeKeyAndVisible];
it will solve all of your issues.
I am writing an iPhone application where I want to utilize the large popup view, but I don't know what it's called. I have a picure on it.
I mean the middle square that isn't shadowed. It has the title "Köp mer utrymme". I know it's from an iPad, but I'm pretty sure a similiar one exists on the iPhone, for example, the iTunes-store agreements. I looked in Apple's UIKit User Interface Catalog, but I couldn't found it there.
Does anyone know what it's called or how to get it?
On iPad it could be a UIPopoverController with a custom view controller inside it, or a modally presented view controller. You can't use that on iPhone (at least not in the same way, popovers don't exist and modal views are full screen).
On iPhone you could use a UIAlertView, or you could search github / cocoacontrols for a suitable 3rd party implementation.
The view on the picture is presented modally. When presenting a view modally, you can customize the presentstion style. The default style is UIModalPresentationFullscreen, but the style in the picture is UIModalPresentationFormSheet.
To present a view controller in that style, you first create an instance of the view controller and then set its style.
MyViewController *vc = [[MyViewController alloc] init];
vc.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:vc animated:YES completion:nil];
Note that isn't possible to change the presentation style for iPhone. (I must have imagined that the iTunes-store agreement wasn't fullscreen.)
Use KGModal.h and KGModal.m class. For a PopVieController is is best ....and easy to make and add control over it and no need to set frame for orientation ....
Find these 2 Class (KGModal.h and KGModal.m)...
Can anyone tell me what the best way to do the following is in Xcode (iPhone).
I have a main navigation screen with some buttons on it. When the user clicks any of the buttons they are taken to a sub-navigation screen with more option buttons on it. Here they click whichever button and are taken to a list of options. Clicking on any list option will display a screen with some information to the user. Each one of these screen ( no matter what section of the app you're in) will look the same. Only text and images on these screens will change.
I have enclosed a diagram that might explain it better. What is the best way to handle this in Xcode? I have tried doing it all in Stroyboard as I'm new to Objective C but just the sheer amount of individual pages is slowing my machine down to a crawl. So a rethink is required.
I am also doing an Android version of this app and I'm using Fragments for this. Can anyone please help?
EDIT: Just got to my devel machine and this is what I have been doing so far. I realise now this is the complete wrong way to do it. I have created a view controller for each "screen" if you like.
So I just create one view controller for all "screen" of e.g. Individual Page as per diagram and then add the text dynamically depending on what screen is selected? Can anyone point me in the direction of a tutorial or what I need to be searching for? I have no idea where to start with this using Xcode.
If the elements of the view are the same (and only the actual text and images are changing), all you need to do in your storyboard is to create one view controller that will have all these ui elements, from code you can then set it up depending on the content that you want to display in it (depending on what the user clicked in the previous view controller).
EDIT:
Not sure why it was downvoted, but i'll be more clear. Clearly that one view controller is not ALL you need to do in the storyboard. It's all you need to do ON the storyboard related to all the elements called Page in the diagram. Then you would have to link it to a PageViewController class and to all the outlets related to configurable UI elements and in the code of your prepareForSegue: method from the Secondary Nav Screen View Controller you would have to configure it accordingly to what you want to show.
Here you can find a good beginner's tutorial, along with many other good tutorials. What you're probably missing is that you also need to tell the storyboard what class the view controller is and how to connect stuff like labels and imageviews to the actual code so that you can configure them appropriately.
I.E.
From what you're describing, it sounds like you want a UINavigationController as your app's window's rootViewController and to show your screens inside that. You want to create four controller classes:
HMMainScreenController
HMSecondaryScreenController
HMListScreenController
HMPageController
Hopefully it's obvious what would be in each. You'd set up your window in your app delegate like this:
HMMainScreenController *mainController = [[HMMainScreenController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:mainController];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.rootViewController = navigationController;
[self.window makeKeyAndVisible];
When the user taps a button in your main controller, you'd do this:
HMSecondaryScreenController *secondaryController = [[HMSecondaryScreenController alloc] init];
// configure it appropriately
[self.navigationController pushViewController:secondaryController];
and so on for your list and page controllers.
actually I'm quite new with Xcode and couldn't find the answer to the following two questions by a google search:
to make it short: I'm working on an iPad app that displays proposals. For this purpose you should choose a proposal from the table in MasterView and then see the details in the DetailsView in landscape mode (but without the MasterView on the Spitscreen).
So when the app starts in landscape mode, I wanna see directly the first proposal full screen on the DetailsView. And when I tap onto the screen the MasterView should popup/unhide with the other proposals in the table. Is this possible?
I wanna display the PDFs in a WebView like in iBooks. That means that the navigation bar is hidden and only when I tap onto the screen the navigation bar should appear at the top of the screen.
I'm kind of sure this questions have been solved somewhere but I couldn't find anything by search so I hope you can help me anyway :-)
Thanks in Advance!
Q1: Use can use one of many methods to present a view (look up under Apple's doc on UIViewController under "Presenting Another View Controller's Content" heading). Two that I have used are: – presentModalViewController:animated: and – presentViewController:animated:completion: (the latter is the latest addition in iOS 5.0)
So let's say you have a detail controller called MyDetailViewController, in your Master View Controller's implementation file (the .m file), under viewDidLoad method, you would do some thing like this to present it as a full screen view.
MyDetailViewController *myDetailViewController = [[MyDetailViewController alloc] initWithNibName:#"MyDetailViewController" bundle:nil];
[myDetailViewController.view setFrame:CGRectMake(0, 0, 1024, 768)]; //might not need this
[self presentViewController:newDetailViewController animated:YES completion:^{
NSLog(#"complete"); //optional
} ];
To dismiss or hide this MyDetailViewController with a tap or touch, you can use UITapGestureRecognizer or touchesEnded method and using one of the dismiss methods (refer back to Apple's UIViewController again for this).
Q2: I personally have not used UIWebView to display PDF and not sure if iBooks is using UIWebview to do it. But to display a varieties of popular documents formats, you can use either the QLPreviewController class or UIDocumentInteractionController. You can hide the toolbar while the document is displayed.
Good luck.
I am learning iPhone development and in my application I have some view but I should use a window, so I want to call a window in an IBaction how can I call a window? I try to use the example with AppDelegate you can see my code :
- (IBAction)start:(id)sender {
self.window = [[[Game1ViewController alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
[self.window makeKeyAndVisible];
}
Game1ViewController is type UIWindow.
Best Regards
I believe your app only gets one window. On top of this you place different views. These can be anything that subclasses UIView. These can be controlled by a UIViewController. Usually there is some sort of design style that dictates how the app is structured, between UINavigationController, UITabController, Master/detail.
If you open Xcode and start with one of their templates such as master/detail you can see the transitions between views and how to make one appear/disappear and the interaction between view and view controller .