When we have an image named Default.png, it will be shown at the loading of the app.
Can we have a button on this image so that, when we click the button only the app continues to the next page?
views:
38answers:
3Not sure if this is what you want, but I think it would accomplish the goal. In one of my apps I display the same default.png image in the applicationDidFinishLaunching
method so that I can animate the transition away from that to the app's main view. If you simply put a button over your default.png image and stuck that to the front of the views chain as the app is finishing launch, it should be seamless.
This is how my code begins that process before setting up all the animation stuffs:
UIImageView *splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
splashView.image = [UIImage imageNamed:@"Default.png"];
[window addSubview:splashView];
[window bringSubviewToFront:splashView];
Yours will of course stick a button in there.
What I would do(and have already done)is add a new UIViewController called SplashscreenViewController. In SplashscreenViewController.h, change the @interface
to this:
@interface SplashscreenViewController : UIViewController {
}
- (IBAction)gotorootviewcontroller;
@end
In Splashscreenviewcontroller.m, add this code:
- (IBAction)gotorootviewcontroller {
(your root view controller goes HERE without parentheses) *root = [[(your root view controller goes here without parentheses) alloc] initWithNibName:@"The name of your root view controller goes HERE" bundle:nil];
[self presentModalViewController:root animated:YES];
}
- (void)viewDidLoad {
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Default.png"]];
}
In Interface Builder, add a rounded rect button and connect File's owner>gotorootcontroller>the button>touch up inside. Save and quit, and now you have to do 1 more thing.
In the MainView.xib, in the options tab(the 1st one) in the inspector, chande the NIB name to Splashscreenviewcontroller.
That is alot, but it is also the most efficient way to do this!