can I pause the default png for a second or two at startup?

Discussion in 'iOS Programming' started by jimhanika, Aug 21, 2008.

  1. macrumors newbie

    Joined:
    Jun 3, 2006
    Location:
    London
    #1
    I would like to pause the initial opening just for effect. A simple splash screen, if you will. Does anybody know if this is possible?
     
  2. macrumors 6502a

    DipDog3

    Joined:
    Sep 20, 2002
    #2
    Just load more stuff when your program starts and that will allow the Default.png to display longer.
     
  3. macrumors regular

    Joined:
    Nov 6, 2006
    #3
    You could try adding:

    Code:
    sleep(2);
    
    To your applicationDidFinishLaunching method...

    -Ross
     
  4. macrumors 68040

    Joined:
    Apr 22, 2005
    #4
    What you want to do is add:

    [NSThread sleepForTimeInterval:numberOfSeconds];

    as the first line in your applicationDidFinishLaunching method in the app delegate.
     
  5. macrumors regular

    Joined:
    Mar 17, 2008
    #5
    Or have everything load, but add a subview of the image to fill up the screen, set up the timer, after 2 seconds, within the callback, remove the splashscreen from the superview and then it goes.

    Sleeping, I think is a bad idea.
     
  6. macrumors 68040

    Joined:
    Apr 22, 2005
    #6
    Why? All it does is pause your app's process. The user can still go back to the home screen.
     
  7. macrumors 6502

    Joined:
    Jun 26, 2008
    #7
    I don't think they can. When they push the home button it posts a quit message to your message queue. Since the thread that's processing your message queue will be frozen (sleeping) it won't process the message until it wakes up and finishes processing the current one. If the home button just killed you, you wouldn't get the applicationWillTerminate message. In general it's a bad idea to sleep in UI threads (or do much of anything time consuming) as it blocks all other UI actions.
     
  8. macrumors regular

    Joined:
    Mar 17, 2008
    #8
    Yes. It just creates a really bad user experience, and your users will have to wait for everything to load once those 2 seconds of hell are over. Why not have your splash screen AND load stuff at the same time. Such a better deal.
     
  9. macrumors 68040

    Joined:
    Apr 22, 2005
    #9
    Yeah you guys are right. When I tried out the code I thought I was able to use the Home button, but I guess I just happened to press it after the sleep was over. I just tried it again with a longer sleep time and the Home button was useless.
     
  10. thread starter macrumors newbie

    Joined:
    Jun 3, 2006
    Location:
    London
    #10
    Sleep or no sleep

    Hi All,

    What a great conversation this has been!

    My original idea was to add a temporary view as a startup that showed an app name, legal and version details etc, and then I realised that the default.png could do that without the added programming, as it loads anyway, hence the question.

    I am working on a database app, and it will not end up as a very large app at all, so sleeping for 1 or 2 seconds is hardly a problem, as the app will load immediately after.

    In saying that, I have another version that changes views, which is good for transition control. We'll see.
     
  11. macrumors 6502a

    Joined:
    Nov 9, 2007
    #11
    Have the posters in this thread read the iPhone Human Interface Guidelines?

    Given the OP and some of the responses, I guess it's worth pointing out that the iPhone Human Interface Guidelines explicitly advises agsint using the launch image as a splash screen, about screen etc.:

    I can imagine games might be an exception (it doesn't really make sense to display a fake interface for games and they tend to take longer to load) and Apple themselves use a splash screen for the Texas Hold'em game. But for normal apps, and in general, I recommend following Apple's HIG. Creating an artificial pause to display the screen for longer seems especially bad for me as it impacts on the user experience - don't make people wait for your apps to load.
     
  12. macrumors regular

    Joined:
    Mar 17, 2008
    #12
    Good point from the HIG. Not only is it so annoying, but sleeping the thread is just a bad idea. No matter how big or small the project is. There are definitely other methods. And I don't think you need a splash screen. It seems awesome but when you actually sit down and think, its so unnecessary. Heh, I used to put a really annoying splashscreen to every app I made when I was like 12 or 13, but I now don't even know why I did that. :)
     
  13. thread starter macrumors newbie

    Joined:
    Jun 3, 2006
    Location:
    London
    #13
    Nobody reads the manual! Or do they?

    I did read this, strangely, but like you I noticed that not even Apple follow it to the letter.

    In our tests and reviews here we didn't see any problem in seeing a 1 or 2 second delay in the startup, because everything is ready to work on the third second in. It really didn't present the type of problem some of the other posters thought it would. A more complex load up would be painful, I think, as you would have the slight delay, and then another delay while it loaded the app. Any longer than 2 seconds is too far, I agree, even for our lightweight app.

    We sat and went through all of the collective apps we have on our iPhones and found a few with a quick startup image. Most go straight into the initial window.

    Unlike your average application on the Mac, which use startup panels, an app on the iPhone assumes a much simpler form, and the initial screen is largely ignored by the majority. Our third idea is to have an info button that shows a subview, which is likely to be the way we will go, I think
     
  14. macrumors regular

    Joined:
    Mar 17, 2008
    #14
    I guess if it works as you want it's fine, but I can assure you non of them sleep the thread. :)
     
  15. macrumors regular

    Joined:
    Feb 10, 2008
    #15
    ive noticed companies like EA and gameloft now using 2 second videos, animated or still, they are movies
     

Share This Page