views:

87

answers:

2

I need to create a checklist using a UITableView with the accessoryView as a custom check box and tick, what would be the best (fast & efficient) way to do this?

Also what would be the best way to tick/untick it from within accessoryButtonTappedForRowWithIndexPath and store/retrieve the current state of the row (checked/unchecked) for example:

-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
   if (something==isChecked) {
       change accessoryView to unchecked
       // do stuff
   } else {
       change accessoryView to unchecked
       // do stuff
   }
}

Thanks!

A: 

I'm not sure how close this is to what you want but it's an example of a to do list that I used to learn about SQLite. http://icodeblog.com/2008/08/19/iphone-programming-tutorial-creating-a-todo-list-using-sqlite-part-1/

E. Criss
Thanks for the reply! I have looked at that tutorial but it navigates to another view which has a button to check it as complete. I'm looking for a way to do it just by tapping the accessoryButton on the item itself.
swaterfall
Well then you need to capture the event associated with the Disclosure Indicator. Once you see that that has been tapped you can go about your business. Plenty of resources if you Google accessory types or DsiclosureIndicator.
E. Criss
I'm asking the best way to do a custom disclosureButton as the accessoryType and how to store/retrieve the currant state of the cell being tapped.
swaterfall
A: 

I have just found Apple has created an example of exactly this! Here is a link for anybody looking for the same thing:

http://developer.apple.com/iphone/library/samplecode/Accessory/Introduction/Intro.html

swaterfall