2012-10-02 1 views
0

J'ai un NSURL qui prend un temps énorme pour charger l'URL, j'ai besoin de montrer un fileur, j'utilise le code ci-dessous, mais le fileur n'est pas la première chose qui apparaît il montre un écran noir d'abord, je veux que l'application pour charger le spinner d'abord comme il se lance jusqu'à ce que l'URL est chargée terminée, Quelqu'un peut-il s'il vous plaît aider à ce sujet, il serait grandement apprécié.chargement sur l'écran de démarrage avec NSURL

[NSThread detachNewThreadSelector:@selector(showLoading) toTarget:self withObject:nil]; 


    NSURL *URL = [NSURL URLWithString:@"http://strappcenter.net/strapp-projects/ohs/admin/jsonstring.php"]; 
    //NSURL *URL = [NSURL URLWithString:@"http://strappcenter.net/strapp-projects/ohs/admin/jsonstring.php"]; 
    NSError *error; 
    NSString *stringFromFileAtURL = [[NSString alloc] 
            initWithContentsOfURL:URL 
            encoding:NSUTF8StringEncoding 
            error:&error]; 


    [NSThread detachNewThreadSelector: @selector(spinEnd) toTarget:self withObject:nil]; 

Répondre

0

Vous devez ajouter l'écran de démarrage qui est exactement comme votre premier écran.
Chargez ensuite les données depuis Internet.
Découvrez this tutorial.

Questions connexes