Skip to content

Instantly share code, notes, and snippets.

@ChrisRisner
Created November 5, 2012 04:13
Show Gist options
  • Save ChrisRisner/4015281 to your computer and use it in GitHub Desktop.
Save ChrisRisner/4015281 to your computer and use it in GitHub Desktop.
iOS Day 11
- (IBAction)tappedLoadData:(id)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
self.lblInfo.text = [defaults objectForKey:@"infoString"];
}
- (IBAction)tappedSaveData:(id)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setValue:@"My saved Data" forKey:@"infoString"];
}
- (IBAction)tappedSaveData:(id)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setValue:@"My saved Data" forKey:@"infoString"];
[defaults synchronize];
}
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
- (IBAction)tappedSaveData:(id)sender;
- (IBAction)tappedLoadData:(id)sender;
@property (weak, nonatomic) IBOutlet UILabel *lblInfo;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment