Multiview Application with splash screen
Alright, so I'm trying to add a slash screen to my app to facilitate navigation. However, I'm quite lost as to where to begin. I'll have several different views that I want to access from the splash screen, and I want to hit a button to get to each of the views. So basically, think of the Facebook App splash screen. That's what I want to have happen.
So, each class I have (blueViewController.h, blueViewController.m) will be a view that I want to be able to hit a button and go to. Could someone either help me with the code to get this to work, or point me toward an a开发者_开发百科wesome tutorial that can help me out? I did some work with subviews and having them transition in and out, but I think just have a new view for each class would be more efficient in this case. If you have any questions, please ask. Thank you!
That sounds pretty easy. In your root view just create multiple buttons. Connect them to different IBAction
methods that create the corresponding view controller, set newController.delegate = self;
then display it with [self presentModalViewController:...]
.
Define a ModalViewDone
protocol with -(void)modalViewDone:(id)sender
, have your main view controller adopt that protocol and implement the method, then define the delegate in the other view controllers as a property of type id <ModalViewDone>
Each of the "subcontrollers" should have a button or something that calls delegate.modalViewDone:self
which should in turn call [self dismissModalViewControllerAnimated:]
and anything else you want to do.
For example code, create a new Xcode project with the "utility application" template and look at how the info button works. Essentially do the same thing with multiple "info buttons" but use the sort of button you want instead of the info buttons, or just do what Hunter said :)
The actual controller used in the Facebook app, TTLauncherView I believe, are part of the Open Source three20 project. You can use that code if you'd like.
http://github.com/facebook/three20
精彩评论