views:

46

answers:

1

i am trying for apply check mark in an application at table view. it is working in Simulator 2.2.1 but not in simulator 3.0.

A: 

The following code let you add a check mark on a UITableView cell.
Tested successfully with the iPhone simulator under SDK 2.2.1 and 3.0.


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Create or reuse cell
NSString *CellIdentifier = [NSString stringWithFormat:@"%d:%d", [indexPath indexAtPosition:0], [indexPath indexAtPosition:1]];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
// Modify cell
switch ([indexPath indexAtPosition:0]) {
    case(0): // First section
        switch ([indexPath indexAtPosition:1]) {
        case(0): // First cell
        cell.textLabel.text = @"Text";
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
        break;
    }
}
return cell;
}
rjobidon