내 목표는 배경, 글꼴 및 크기와 함께 내 자신의 셀 스타일을 정의하는 것입니다. 나는 이것을 시험해 본다.TableView는 willDisplayCell에 입력하지 않습니다
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
ScreenListElements *currentScreenElement = [self.screenDefBuild.elementsToTableView objectAtIndex:indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:currentScreenElement.objectName];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:currentScreenElement.objectName];
}
cell.textLabel.text = currentScreenElement.objectName;
return cell;
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.contentView.backgroundColor = [UIColor blackColor];
}
셀 backgrond를 변경하고 싶습니다. 그러나 앱이 willDisplayCell 메소드에 들어가지 않습니다. 수업을 다음과 같이 선언했습니다.
@interface MyTableView : UIViewController <UITableViewDataSource,NSCopying> {
}
내가 다른 것을 가지고 있어야합니까? 아니면 자신의 셀 스타일을 선언하는 더 좋은 방법 일 수도 있습니다.
는 UITableViewDelegate'이 – Novarg