IanMK2 Blog

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"MatzipCustomCell";
    
    MatzipCustomCell *cell = (MatzipCustomCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        NSArray * nib= [[NSBundle mainBundle] loadNibNamed:@"MatzipCustomCell" owner:self options:nil];
cell = (MatzipCustomCell*)[nib objectAtIndex:0];        
UIView *bgv = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, cell.frame.size.width)];
[bgv setBackgroundColor:[UIColor colorWithRed:1.0f green:50.0f/255.0f blue:50.0f/255.0f alpha:1.0f]];
[cell setSelectedBackgroundView:bgv];
[bgv release];
    }
NSMutableDictionary *ary = [XMLData objectAtIndex:indexPath.row];
cell.nameLabel.text = [ary objectForKey:@"name"];
cell.numLabel.text = [NSString stringWithFormat:@"%@명 평가", [ary objectForKey:@"reviewCnt"] ];
[cell.imageView setImage:[UIImage imageNamed:@"star.png"]];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}
임시적으로 뷰를 생성하고 색을넣은다음 그것을 셀의 선택색으로 지정한다.
Posted by IanMK2