Intro Page for 5 Seconds after the default.png file and before the MainWindow.nib

I had created a project where the default.png sleeps for 3 seconds and then the MainWindow.xib is loaded I wanted to create a new IntroPageViewController.xib before the FirstPageViewController.xib loads . I wanted to put some text in the IntroPage which loads for 10 seconds and has a skip button . I already created the FirstPageViewController.xib , now I want to load IntroPageViewController.xib in applicationdidfinishlaunching .

I tried to make changes in the FirstPageAppDelegate.h and .m but still the FirstPageViewController.xib loads and if I make changes to info.plist to load IntroPageViewController.xib or IntroPageViewController the application crashes . Help needed please .

Thanks a ton in advance :)

Regards, Coder

Answers


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.


use nstimer to create some timer. The corresponding action will be executed after 10 sec or when skip button will be pressed.


Need Your Help

Stretch width of div background image with set height

html css background width stretch

I am trying to stetch a div background image but not keep the aspect ratio. So I want a fixed height of 270px and a width 100% of the screen. It works perfectly in chrome but not in IE or Firefox. ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.