저는 이것을 cellForRowAtIndexPath에서 사용한다고 가정합니다.
UITableViewCell class reference에 따르면
참고 : ( 있는 UIView에 의해 선언 된 의 backgroundColor 속성을 통해 셀의 배경 색상 를 설정하여) 셀의 배경색을 변경하려는 경우를 해야합니다. tableView : willDisplayCell : forRowAtIndexPath : 위임자가 아닌 tableView : cellForRowAtIndexPath : 데이터 원본.
그래서 이렇게 :
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.backgroundColor = [UIColor redColor]; //must do here in willDisplayCell
cell.textLabel.backgroundColor = [UIColor redColor]; //must do here in willDisplayCell
cell.textLabel.textColor = [UIColor yellowColor]; //can do here OR in cellForRowAtIndexPath
}
당신이 셀 디스플레이를 통해 세밀한 제어가 필요한 경우, 쉬운 방법은 IB 그것을 디자인하고 cellForRowAtIndexPath에서 펜촉에서로드하는 것입니다. 테이블 뷰 프로그래밍 가이드의 this page에있는 "Nib 파일에서 사용자 정의 테이블 뷰 셀로드하기"섹션을 참조하십시오.
신난다. 감사 –