2010-01-22 8 views

답변

1

NSUserDefaults은 데이터 스 니펫을 잘 유지합니다.

예 :

- (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]; 
} 

가 지속 및 정수

+0

JoePasq에게 감사드립니다. – RAGOpoR

관련 문제