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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-13-2010, 07:39 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 81
Default NSUser Defaults

Hey, I was wondering if there is a NSUser default to save the location of an image on your app. If so, please help me understand how to incorporate it into my application.

EXAMPLE: In pokemon video games they have a saving feature. This helps you continue your adventure the next time you play the game. I was wondering if you guys know how to basically re-create that feature in an iphone app using NSUser defaults or any other way.

Please help me.

Thanks,
TheRealNosserMan
therealnosserman is offline   Reply With Quote
Old 03-19-2010, 11:42 AM   #2 (permalink)
Indie Dev
 
hm50's Avatar
 
Join Date: May 2009
Location: South Bend, Indiana
Posts: 162
Post

Code:
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *yourPosition = [prefs stringForKey:@"position"];
						
NSLog(@"Your position is: %@",yourPosition);

//To set a default
NSString *newPosition = @"here";
[prefs setObject: newPosition forKey:@"position"];
NSUserDefaults will accept BOOLs,Strings, FLOATs, and INTs I believe.

I just showed using string values, but in your case you may want to use a FLOAT type for each part of your position. Search NSUserDefaults for more info.
__________________
iPhone 3G

Support Indie Devs!! (that goes for newbs too!)

Apps:
Spell Blocks
See Read Say
iStatus
myVIP
myMVP
hm50 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 256
20 members and 236 guests
ADY, Alsahir, beleg_1998, Dani77, e2applets, iDifferent, iph_s, JamesCahall, JasonR, mer10, Monstertaco, prchn4christ, Promo Dispenser, Robiwan, Rudy, smithdale87, spiderguy84, timle8n1, Touchmint
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,880
Threads: 89,228
Posts: 380,756
Top Poster: BrianSlick (7,129)
Welcome to our newest member, @sandris
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:18 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0