I'm wanting to be able to import an image to an imageview, then save it, and when relaunching the app it's still there. I know how to "save data" with text only:
ViewController.H
...
If I try to do this with an image, it doesn't work and it gives me an error. Can anyone please help me?
ViewController.H
...
Code:
{
UITextView *textfield;
}
-(IBAction)savetext: (id)sender;
@property (nonatomic, retain) IBOutlet UITextView *textfield;
ViewController.M
-(IBAction)savetext: (id)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:textfield.text forKey:@"text"];
[defaults synchronize];
}
- (void)viewDidLoad {
[super viewDidLoad];
textfield.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"text"];
}
If I try to do this with an image, it doesn't work and it gives me an error. Can anyone please help me?
Last edited by a moderator: