设置IOS应用引导动画

iOS设备现在有三种不同的分辨率:iPhone 320x480、iPhone 4 640x960、iPad 768x1024。以前程序的启动画面(图片)只要准备一个 Default.png 就可以了,但是现在变得复杂多了。下面就是 CocoaChina 会员做得总结
  如果一个程序,既支持iPhone又支持iPad,那么它需要包含下面几个图片:
Default-Portrait.png iPad专用竖向启动画面 768x1024或者768x1004
Default-Landscape.png iPad专用横向启动画面 1024x768或者1024x748
Default-PortraitUpsideDown.png iPad专用竖向启动画面(Home按钮在屏幕上面),可省略 768x1024或者768x1004
Default-LandscapeLeft.png iPad专用横向启动画面,可省略 1024x768或者1024x748
Default-LandscapeRight.png iPad专用横向启动画面,可省略 1024x768或者1024x748
Default.png iPhone默认启动图片,如果没有提供上面几个iPad专用启动图片,则在iPad上运行时也使用Default.png(不推荐) 320x480或者320x460
[email protected] iPhone4启动图片640x960或者640x920

  为了在iPad上使用上述的启动画面,你还需要在info.plist中加入key: UISupportedInterfaceOrientations。同时,加入值UIInterfaceOrientationPortrait, UIInterfacOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight。

 

设定启动图片显示时间

到此为止,基本工作就已经完成了。但是在运行应用时,你会发现启动图片显示的时间非常短!那么如何设置iOS启动图片的显示时间呢?因为我们实在不想让美工精心设计的图片就这么一闪而逝了。另外,我们还可以在显示启动图片时做些其他事情,譬如:播放一小段音频,吸引一下用户的注意力。

 在导航区域点击并打开“AppDelegate.m”文件加入以下代码:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
 {
     // Override point for customization after application launch.
     [NSThread sleepForTimeInterval:5];
     
     return YES;
 }
 

猜你喜欢

转载自zhy584520.iteye.com/blog/1684324