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

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

    Even though it is against the guidelines but if you still want to do this than a better approach rather than sleeping thread will be

    //Extend the splash screen for 3 seconds.
    [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:3]];
    

    this way the main thread is not blocked and if it is listening for any notifications and some other network related stuff, it still carries on.

    UPDATE FOR SWIFT:

     NSRunLoop.currentRunLoop().runUntilDate(NSDate(timeIntervalSinceNow:3))
    

提交回复
热议问题