2010-01-22 7 views

Répondre

1

NSUserDefaults tient bien sur des extraits de données.

Exemple:

- (void)applicationDidFinishLaunching:(UIApplication *)application { 
    [window addSubview:tabBarController.view]; 
    if ([[NSUserDefaults standardUserDefaults] integerForKey:kTabIndexKey]) 
     tabBarController.selectedIndex = [[NSUserDefaults standardUserDefaults] integerForKey:kTabIndexKey]; 
} 

- (void)applicationWillTerminate:(UIApplication *)application { 
    [[NSUserDefaults standardUserDefaults] setInteger:tabBarController.selectedIndex forKey:kTabIndexKey]; 
} 

Persiste et charge un nombre entier (méthode serait "setString" et "stringForKey", vérifier les docs.)

+0

merci JoePasq, je vais essayer – RAGOpoR

Questions connexes