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

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

    Here is my simple splash screen code. 'splashView' is an outlet for a view that contains an image logo, UIActivityIndicator, and a "Load.." label (added to my 'MainWIndow.xib' in IB). The activity indicator is set to 'animating' in IB, I then spawn a separate thread to load the data. When done, I remove the splashView and add my normal application view:

    -(void)applicationDidFinishLaunching:(UIApplication *)application {
        [window addSubview:splashView];
        [NSThread detachNewThreadSelector:@selector(getInitialData:) 
                                     toTarget:self withObject:nil];
    }
    
    -(void)getInitialData:(id)obj {
        [NSThread sleepForTimeInterval:3.0]; // simulate waiting for server response
        [splashView removeFromSuperview];
        [window addSubview:tabBarController.view];
    }
    

提交回复
热议问题