Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-09-2009, 05:42 PM   #1 (permalink)
SimonCowell
Registered Member
 
Join Date: May 2009
Posts: 26
Default Save State of Picker

I am trying to save a picker row so that it displays the same selection the next time a user loads the app.
I'm not getting any warnings or errors, but the changes aren't saving. Any suggestions?

Code:
NSUserDefaults *wheelPrefs = [NSUserDefaults standardUserDefaults];
	wheelPicker = [wheelPrefs objectForKey:@"wheelData"];
	[wheelPrefs synchronize];
Code:
-(void)applicationDidTerminate {
	NSUserDefaults *wheelPrefs = [NSUserDefaults standardUserDefaults];
	[wheelPrefs setObject:[NSNumber numberWithInt:[wheelPicker selectedRowInComponent:0]] forKey:@"wheelData"];
}
Cheers
SimonCowell is offline   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,050
Threads: 38,834
Posts: 170,355
Top Poster: smasher (2,561)
Welcome to our newest member, Giulio_b
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:43 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.