Instead of loading the IntroPageViewController.xib ahead of the FirstPageViewController.xib manually, try this:
- When the FirstPage loads, show the
IntroPage view on top of it.
- After a delay or when skip button is
pressed, remove the IntroPage.
Here's how:
Make an IntroPageViewController with corresponding xib file.
In Xcode, setup a button and an action method for that button.
// in your .h file.
@interface IntroViewController : UIViewController {
UIButton *skipButton;
}
@property (nonatomic, retain) IBOutlet UIButton *skipButton;
-(IBAction)skipPressed;
@end
// in the .m file
-(IBAction)skipPressed {
[self.view removeFromSuperview]; // this removes intro screen from the screen, leaving you FirstView
}
// put this in the viewDidLoad method
- (void)viewDidLoad {
[super viewDidLoad];
[self performSelector:@selector(skipPressed) withObject:nil afterDelay:5];
}
// add these in FirstViewController.m
#import "IntroViewController.h"
- (void)viewDidLoad {
[super viewDidLoad];
IntroViewController *introViewController = [[IntroViewController alloc] initWithNibName:@"IntroViewController" bundle:[NSBundle mainBundle]];
[self.view addSubview:introViewController.view];
[introViewController release]; // this removes your IntroScreen from memory once it disappears offscreen
}
Now the next step is to open IntroViewController.xib in Interface Builder and drag a UIButton to the view, set its title to 'Skip'.
Connect the button to the skipPressed action and connect File's Owner to the button.
Go back to Xcode and Build and Run to test it. If all is well, your IntroView should be visible at launch time for 5 seconds or until you touch the Skip button.