How can I display a splash screen for longer on an iPhone?

前端 未结 24 1903
滥情空心
滥情空心 2020-11-27 11:37

How can I display a splash screen for a longer period of time than the default time on an iPhone?

24条回答
  •  暖寄归人
    2020-11-27 12:12

    I did it pretty simply, by having my rootViewController push a modalViewController, loading from "Splash.nib" in a subclass of UIViewController I called "SplashViewController". The exact call was:

    - (void) viewDidLoad {
    SplashViewController *splashScreen = [[[SplashViewController alloc]    
            initWithNibName:@"SplashViewController" bundle:nil] autorelease];
    [self presentModalViewController:splashScreen animated:NO];
    //continue loading while MVC is over top...
    

    When you launch the app, it pops right up, like a splash screen should. Then, the SplashViewController nib is just a full-screen UIImageView with a splash png, 320x480. After a 1-second NSTimer (anything more did seem to get in the way), it fires timerFireMethod, a custom method that just calls

    [self dismissModalViewControllerAnimated:YES];
    

    Then the modal VC just slides down and away, leaving my top tableView. The nice thing is, while the MVC is up, the underlying table can continue to load due to the independent nature of modal view controllers. So, I don't think this violates the HIGs, and actually does allow for faster launching. What would you rather look at, a cute picture, or an empty default view (snore)?

提交回复
热议问题