**New to iOS dev and programming in general. Patience please.
I have looked everywhere for something that I can understand and implement that will allow me to save and retrieve check marks for static tableview cells.
I have tried:
saving checkmark accessory value in nsuserdefaults and then retreving them
how to save the state in userdefaults of accessory checkmark-iphone
and countless others.
It is probably my lack of knowledge that is causing the problems.
I have a tableview with static cells. I have implemented the check mark for multiselection, per Apple's instructions as follows:
- (void)tableView:(UITableView *)theTableView
didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath {
[theTableView deselectRowAtIndexPath:[theTableView indexPathForSelectedRow] animated:NO];
UITableViewCell *cell = [theTableView cellForRowAtIndexPath:newIndexPath];
if (cell.accessoryType == UITableViewCellAccessoryNone) {
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
cell.accessoryType = UITableViewCellAccessoryNone;
}
}
This works fine for selecting and unselecting multiple rows, which then display the checkmark.
How do I save those checkmarks to user defaults so that they reload everytime for that tableview?
When I try to set the object for the NSUserDefaults, I get an error that says "Implicit conversion of NSInteger to 'id' is disallowed with ARC" and "Incompatible integer to pointer conversion sending NSInteger to parameter type of 'id'".
Any help is much appreciated, even if it is just pointing me to a resource that is understandable for a rookie.
Thank you!