Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 11-21-2009, 12:49 PM   #4 (permalink)
k2c
Registered Member
 
Join Date: Oct 2009
Posts: 26
k2c is on a distinguished road
Question

Thank you very much for spending time to answer my question, _sjc_!
I just tried the code you suggested, but it didn't save previous status of switches. Did I miss something?

.m file
Code:
-(void)applicationDidFinishLaunching:(UIApplication *)app {
	
    NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
	
    SwitchOne.on = [defs boolForKey: @"MYSwitchOne"];
    SwitchTwo.on = [defs boolForKey: @"MYSwitchTwo"];
}

-(void)applicationWillTerminate:(UIApplication *)app {
	
    NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
	
    [defs setBool: SwitchOne.on forKey: @"MYSwitchOne"];
    [defs setBool: SwitchTwo.on forKey: @"MYSwitchTwo"];
}

.h file
Code:
-(void)applicationDidFinishLaunching:(UIApplication *)app;
-(void)applicationWillTerminate:(UIApplication *)app;
k2c is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,367
Threads: 93,995
Posts: 402,444
Top Poster: BrianSlick (7,978)
Welcome to our newest member, nelsonmcnichol
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:36 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.