if got a tableview and the user can add strings into it:
-(IBAction)textFieldDidEndEditing {
NSString *string = textField.text;
[tableAr开发者_高级运维ray addObject:string];
[mainTableView reloadData];
textField.text = @"";
}
how can I store the content of the tableView into the NSUserdefaults? can anybody give me a short example please?
thanks :)
try storing whole Array as an Object into NSUserDefaults
NSUserDefaults *default = [NSUserDefaults standardUserDefaults];
[default setObject:tableArray forKey:@"key"];
& now to fetch it from NSUserDefautls:
NSArray *array = [standardUserDefaults objectForKey:@"key"];
Hope this solve some sort of problem of urs. :)
精彩评论