0

in my appdelegate i have method which shows the Default.png for 3 seconds(splashscreen):

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
        sleep(3);
    // Override point for customization after application launch.

    // Add the view controller's view to the window and display.
        [window addSubview:viewController.view];
        [window makeKeyAndVisible];
        return YES;
}

i need to show with the splashscreen a progressbar which show the 3 seconds loading, can you help me please, it seems that all work (the progressbar creation and initialisation) should be in this method :)

Michaël
  • 6,676
  • 3
  • 36
  • 55
Malloc
  • 15,434
  • 34
  • 105
  • 192
  • The purpose of a splash page is to give users something to look at while your app is loading. Freezing the app to force your splash page to stay up longer is silly and borderline malicious. – kubi Apr 06 '11 at 15:23
  • Apple agrees with you, so it's not exactly best practice. However, there are some purposes to keep the splash screen open longer, and I've seen some examples from Apple where they use it. – Stian Storrvik Apr 06 '11 at 15:25
  • Not to mention you might get rejected by Apple for doing something like that. – sudo rm -rf Apr 06 '11 at 15:26
  • Might is the keyword - if you have a good purpose, I don't see the problem, and neither does Apple. So it's really no point in downvoting this question for that matter. However, there are probably plenty of questions like this on stackoverflow already :) – Stian Storrvik Apr 06 '11 at 15:28
  • 1
    @lecou Games do it because they need the extra time to load resources. @Malek isn't actually doing any work during that three seconds, he's just freezing his app. I can maybe see doing this if you've got some license info users need to read, but you should be doing that in a modal view, not on the splash screen. – kubi Apr 06 '11 at 15:30
  • The question I should have asked: @Malek, why do you want to do this? – kubi Apr 06 '11 at 17:29

1 Answers1

4

initialize a nstimer with 1 second interval before the sleep(3) which triggers a selector (a method). this selector should update your progressbar by +1, and when it hits 3, you can disable the nstimer.

here's the class reference for NSTimer, and here's a great guide of how you use it :)

Community
  • 1
  • 1
Stian Storrvik
  • 2,199
  • 2
  • 14
  • 21