0
사전에 도움을 주셔서 감사합니다 -왜 사용자 정의 셀이 비어 있습니까?
나는 사용자 정의 셀이있는 UITableView 있습니다. 내가 브레이크 포인트를 삽입하고 올바른 셀의 값을 기록,하지만 난 코드를 실행할 때 테이블 뷰는 항상 비어있는 경우에 대한
Cell *cell = (Cell *)[tableView dequeueReusableCellWithIdentifier:[Cell reuseIdentifier]];
if (cell == nil)
{
cell = [Cell cell];
}
StoreData *currentStore = [_storeArray objectAtIndex:indexPath.row];
cell.phoneNumber.text = currentStore.phoneStr;
cell.address.text = currentStore.addressStr;
return cell;
감사합니다 (그러나 않습니다 세포의 오른쪽 번호를 가지고) 도움
"StoreData * currentStore = [_storeArray objectAtIndex : indexPath.row];"에 중단 점을 두십시오. 셀이 nil인지 확인하십시오. – dRAGONAIR
그 코드의 조각만을 사용하여 디버깅하는 것은 어렵습니다. 그러나 검사 할 수있는 다른 것들은 입니다. 1. tableView에 등록 된 경우 셀의 셀 2. "currentStore"가 nil (또는 데이터 있음)이 아닌지 확인할 수 있습니다. 3. "cell.phoneNumber"및 "cell.address"에 bkground 색상을 지정하여 추가되어 있는지 확인합니다 보기/ 또는 print "cell.contentView.subviews"로 언급 한 위의 if 문 다음에 중단 점을 넣으십시오. – dRAGONAIR