Display Splash Screen in iPad

In this application we will see how to display Splash Screen in iPad.

Step 1: Create a View base application using template. Give the application name “DisplaySplash_iPad”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: Expand classes and notice Interface Builder created the DisplaySplash_iPadViewController class for you. Expand Resources and notice the template generated a separate nib, DisplaySplash_iPadViewController.xib, for the “DisplaySplash_iPad”.

Step 4: We need to add one resource in the resource folder for display splash.

Step 5: In the DisplaySplash_iPad.h file, we have created instance of UIView class and two methods. So make the following changes in the file.

#import <UIKit/UIKit.h>

@interface DisplaySplash_iPadViewController : UIViewController {

        IBOutlet UIView *displaySplashScreen;
       
}

(void)displayScreen;
(void)removeScreen;

Step 6: Double click the DisplaySplash_iPadViewController.xib file and open it to the Interface Builder. Drag the view from the library and place it to the Main Window. Open the second view icon from the MainWindow,drag the image view from the library and place it to the view window,select the view and bring up Attribute Inspector select the image “themes.png”. Select the File’s Owner icon from the MainWindow and bring up Connection Inspector, drag from the displayScreen to the last view icon and connect File’s Owner icon to the view. Now save it , close it and go back to the Xcode.

Step 7: Open the DisplaySplash_iPad.m file and make the following changes in the file.

(void)displayScreen
{
       
        UIViewController *displayViewController=[[UIViewController alloc] init];
        displayViewController.view = displaySplashScreen;
        [self presentModalViewController:displayViewController animated:NO];
    [self performSelector:@selector(removeScreen) withObject:nil afterDelay:6.0];
       
       
}

(void)removeScreen
{
        [[self modalViewController] dismissModalViewControllerAnimated:YES];
}

Step 8 : Now compile and run the application in the Simulator.

You can Download SourceCode from here DisplaySplash_iPad

Leave a Reply

Your email address will not be published.