更改iPhone的初始屏幕时间
我如何让启动屏幕停留更长时间,例如5秒钟?
您需要创build一个视图控制器来显示启animation面,如下所示。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self generateRandomSplashScreen]; [self performSelector:@selector(removeSplashScreen) withObject:nil afterDelay:SPLASHSCREEN_DELAY]; [self otherViewControllerLoad]; // the other view controller [self.window makeKeyAndVisible]; return YES; } -(void) generateRandomSplashScreen { splashScreenViewController = [[SplashScreenController alloc] initWithNibName:@"SplashScreenController" bundle:[NSBundle mainBundle]]; [self.window addSubview:self.splashScreenViewController.view]; } -(void) removeSplashScreen { [splashScreenViewController.view removeFromSuperview]; self.window.rootViewController = self.tabBarController; [splashScreenViewController release]; }
写你的sleep(5.0)
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
方法。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { /*this will pause main thread for x interval seconds. put on the top of application:didFinishLaunchingWithOptions, so it will not proceed to show window until sleep interval is finished.*/ [NSThread sleepForTimeInterval:5]; //add 5 seconds longer. //other code.... }
可能您所说的启animation面是“default.png”文件。 正如JustSid所提到的,这个文件并不打算成为启animation面,而是用作第一个屏幕快照,以提高用户在应用程序加载时的体验。 检查人机界面指南
如果你想实现splashscreen,你应该使用ie。 NSTimer和UIView组件。