Posted
Filed under iphone
[cell setSelectionStyle:UITableViewCellSelectionStyleBlue]; // 파란색
[cell setSelectionStyle:UITableViewCellSelectionStyleGray]; // 회색
[cell setSelectionStyle:UITableViewCellSelectionStyleNone]; // 없음


UITableViewCell에서는 Highlighted상태일 때 setHighlighted:animation: 메소드가 호출된다.


//- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
- (void)configureCell:(CustomTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
    NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:indexPath];
    cell.textLabel.text = [[managedObject valueForKey:@"timeStamp"] description];
}

// Customize the appearance of table view cells.
- (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];
    }
     */
   
   
    CustomTableViewCell *cell = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[CustomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    }

    // Configure the cell.
    [self configureCell:cell atIndexPath:indexPath];
    return (UITableViewCell *)cell;
}

2011/12/12 12:04 2011/12/12 12:04