|
|
#1 |
|
TableView Checklist
Hey guys so part of my app is a checklist. The table is shown as a group rather then plain.
So basically every time they select a row it puts the accessoryCheckmark at the end of the row and removes the checkmark from everywhere else. Is there a method or a function that basically works like Code:
if (indexPath.row isSelected) {
cell.AccessoryType = UITableViewAccessoryCheckmark;
} else
cell.AccessoryType = UITableViewAccessoryNone;
__________________
- 30 GB iPod Video - Black - 13.3" MB - 4GB RAM - 500GB 7200RPM HDD - 16 GB iPhone 4 - Black - Game Center Tag: GhostDZ9 |
|
|
|
0
|
|
|
#2 |
|
I would suggest adding a Boolean flag to the data source model you use to back your table view. Then you can check against that.
__________________
|
|
|
|
0
|
|
|
#3 |
|
How would I go about doing that?
__________________
- 30 GB iPod Video - Black - 13.3" MB - 4GB RAM - 500GB 7200RPM HDD - 16 GB iPhone 4 - Black - Game Center Tag: GhostDZ9 |
|
|
|
0
|
|
|
#4 |
|
Maybe explain how you have your data source set up.
__________________
|
|
|
|
0
|
|
|
#5 |
|
Ive actually figured it out, I created an int var and then did this code
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
if (indexPath.row == selectedRow){
cell.accessoryType = UITableViewCellAccessoryCheckmark;
} else {
cell.accessoryType = UITableViewCellAccessoryNone;
}
cell.textLabel.text = [rows objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
selectedRow = indexPath.row;
[self.tableView reloadData];
}
__________________
- 30 GB iPod Video - Black - 13.3" MB - 4GB RAM - 500GB 7200RPM HDD - 16 GB iPhone 4 - Black - Game Center Tag: GhostDZ9 |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| Use TableView without TableView Delegate or DataSource | mikezang | iPhone/iPad Programming | 3 | Dec 15, 2010 11:58 AM |
| HDTV Checklist / Recommendations | ~Shard~ | Buying Tips and Advice | 159 | Aug 5, 2007 03:23 AM |
| Refurb Checklist? Anything to look for? | DrumaChick420 | Buying Tips and Advice | 2 | Apr 9, 2006 10:49 PM |
| Switcher's Checklist for Panther Upgrade | MacBytes | MacBytes.com News Discussion | 0 | Oct 29, 2003 01:33 AM |
| checklist for buying from private owner | Applehead | Macintosh Computers | 0 | Jul 16, 2003 05:37 AM |
All times are GMT -5. The time now is 09:48 AM.






I support the 
Linear Mode

