您的位置:首页 > 移动开发 > IOS开发

iOS程序启动画面的制作

2013-02-02 11:18 239 查看
iPhone开发实现splash画面非常简单,做一张名为Default.png的欢迎界面图片放在Supporting Files文件夹下替换掉默认的Default.png(为了适配,需要做Default.png、Default@2x.png、Default-568h@2x.png三种尺寸各一张)。 在XXXAppDelegate.m的- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions方法中插入以下一行代码:

// Insert delay of 5 seconds befor the splash screen disappers.

[NSThread sleepForTimeInterval:5.0]; // 其实这一行代码也可以不加,因为默认情况下欢迎界面的时间只有一秒,加这一句是为了延长

欢迎界面的展示时间到5秒,时间大家可以自己定义。

例如:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

// Override point for customization after application launch.

self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil]autorelease];

// Insert delay of 5 seconds befor the splash screen disappers.

[NSThread sleepForTimeInterval:5.0];

// Override point for customization after applicationlaunch.

// Add the view controller’s view to the window anddisplay.

self.window.rootViewController = self.viewController;

[self.window makeKeyAndVisible];

return YES;

}

这样splash页面就停留5秒后,消失了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: