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

前端 未结 24 1937
滥情空心
滥情空心 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:15

    I needed to do this to block showing a table view until the data was loaded over the network. I used a variation of one I found here:

    http://michael.burford.net/2008/11/fading-defaultpng-when-iphone-app.html

    In the interface of your App Delegate:

    
    @interface AppDelegate : NSObject 
    {
      UIImageView *splashView;
    }
    

    In the implementation:

    
    @implementation AppDelegate
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    
    
      // After this line: [window addSubview:tabBarController.view];
    
      splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
      splashView.image = [UIImage imageNamed:@"Default.png"];
      [window addSubview:splashView];
      [window bringSubviewToFront:splashView];
    
      // Do your time consuming setup
    
      [splashView removeFromSuperview];
      [splashView release];
    }
    
    

    Make sure you have a Default.png in the resources

提交回复
热议问题