Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can pass <code>NSString</code> or <code>NSMutableArray</code> using <code>NSUserDefault</code> method... <a href="http://codeexamples.wordpress.com/2011/02/12/nsuserdefaults-example/" rel="nofollow">NSUserDefaultExample</a> and <a href="http://www.icodeblog.com/2008/10/03/iphone-programming-tutorial-savingretrieving-data-using-nsuserdefaults/" rel="nofollow">Saving/Retrieving Data Using NSUserDefaults</a></p> <p>For Saving</p> <pre><code> NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; // saving an NSString [prefs setObject:@"TextToSave" forKey:@"keyToLookupString"]; // saving an NSInteger [prefs setInteger:42 forKey:@"integerKey"]; // saving a Double [prefs setDouble:3.1415 forKey:@"doubleKey"]; // saving a Float [prefs setFloat:1.2345678 forKey:@"floatKey"]; // saving an array NSData *data = [NSKeyedArchiver archivedDataWithRootObject:array]; [prefs setObject:data forKey:@"lastResults"] // This is suggested to synch prefs, but is not needed (I didn't put it in my tut) [prefs synchronize]; </code></pre> <p>For Retrieving</p> <pre><code>NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; // getting an NSString NSString *myString = [prefs stringForKey:@"keyToLookupString"]; // getting an NSInteger NSInteger myInt = [prefs integerForKey:@"integerKey"]; // getting an Float float myFloat = [prefs floatForKey:@"floatKey"]; // getting an array NSData *dataRepresentingSavedArray = [prefs objectForKey:@"lastResults"]; if (dataRepresentingSavedArray != nil) { NSArray *oldSavedArray = [NSKeyedUnarchiver unarchiveObjectWithData:dataRepresentingSavedArray]; if (oldSavedArray != nil) objectArray = [[NSMutableArray alloc] initWithArray:oldSavedArray]; else objectArray = [[NSMutableArray alloc] init]; } </code></pre> <p>or</p> <pre><code>filename *detailViewController = [[filename alloc] initWithNibName:@"filename" bundle:nil]; detailViewController.audio=@"yourData"; [self presentModalViewController:detailViewController animated:YES]; [detailViewController release]; </code></pre> <p>Declare in filename.h</p> <pre><code> NSArray *audio; @property(nonatomic,retain) NSArray *audio; </code></pre> <p>and filename.m</p> <pre><code> @synthesize audio; </code></pre> <p>thats all.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload