0
我有兩個文本框和一個數組。如何調用nsuserdefaults到tableview
NSMutableArray *myArray = [[NSMutableArray alloc]init];
[myArray addObject:textFieldHeader.text];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:myArray forKey:textFieldGroup.text];
textFieldGroup.text傳遞給tableview中和
-(void)viewWillAppear:(BOOL)animated
{
NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
array = [[NSMutableArray alloc] initWithArray:[standardUserDefaults objectForKey:_passedFieldGroup]];
[self.tableView reloadData];
}
但我怎麼把這些鍵的部分和對象行,當我去表視圖?
你正在實現['UITableViewDataSource'](https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewDataSource_Protocol/Reference/Reference.html)方法嗎? –