给iPhone添加splash页面又一法

Posted by Elton's Blog on October 25, 2010

之前有发过一篇文章,介绍了如何添加splash页面

现在发现有一个更简单的方法。

  1. 将你需要的splash界面的图片,存成Default.png
  2. 在XXXAppDelegate.m程序中,插入如下代码:
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //--insert a delay of 5 seconds before the splash screen disappears--
    [NSThread sleepForTimeInterval:5.0];
    // Override point for customization after application launch.
    // Add the view controller’s view to the window and display.
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];
    return YES;
}

这样splash页面就停留5秒后,消失了。