- (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;
}
임시적으로 뷰를 생성하고 색을넣은다음 그것을 셀의 선택색으로 지정한다.
'Objective-C' 카테고리의 다른 글
[iPhone] HTTP POST를 이용한 이미지 전송 (0) | 2010.11.03 |
---|---|
[iPhone]공백, 탭, 개행 제거 및 문자열 검색, 비교 (0) | 2010.11.01 |
[iPhone]구글맵을 박아넣자 MKMapView (0) | 2010.10.31 |
[iPhone]전화걸기 (0) | 2010.10.31 |
[iPhone]네비게이션바에 오른쪽 버튼 추가하기 & 텍스트편집후 키보드 넣기 & 스크롤 (0) | 2010.10.31 |