UITableView
에 대한 사용자 정의 UITableViewCell
을 만들고 레이블을 드래그 앤 드롭하여을 프로토 타입 셀에서 QuizInfoCell이라고하는 사용자 정의 셀로 작성했습니다.많은 UITableView에 사용자 정의 UITableViewCell 사용
프로토 타입 셀을 만든 특정 TableView
에 대해서는 정상적으로 작동하지만 QuizInfoCell
을 다른 어떤 장치에도 사용할 수 없습니다. TableView.
어떻게 구현할 수 있습니까?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
QuizInfoCell *cell = nil;
cell = [tableView dequeueReusableCellWithIdentifier:@"QuizInfoCell" forIndexPath:indexPath];
if (cell == nil){
cell = [[QuizInfoCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"QuizInfoCell"];
}
cell.name.text = [title objectAtIndex:indexPath.row];
cell.author.text = [author objectAtIndex:indexPath.row];
cell.time.text = [[ValueHandler alloc] getDateString:[timeStamp objectAtIndex:indexPath.row]];
cell.plays.text = [@"Plays: " stringByAppendingString:[NSString stringWithFormat:@"%@", [plays objectAtIndex:indexPath.row ]]];
cell.ratingUps.text = [NSString stringWithFormat:@"%@", [ratingUps objectAtIndex:indexPath.row]];
cell.ratingDowns.text = [NSString stringWithFormat:@"%@", [ratingDowns objectAtIndex:indexPath.row]];
cell.qid.text = [NSString stringWithFormat:@"%@", [qid objectAtIndex:indexPath.row]];
return cell;
}
: 어떤 오류 y 오우. 그런 다음 항목을 만든 위치에 따라 사용자 정의 셀 클래스 – TamilKing
을 표시하십시오. 다른 항목에서로드해야 할 항목이 있습니다. 스토리 보드 나 xib에서 만들었습니까? – madmik3
스토리 보드에 제작했습니다. 셀의 h 파일에는 레이블 만 들어있었습니다. 나는 m 파일을 전혀 변경하지 않았다. –