Подтвердить что ты не робот

Несовместимый тип указателя, инициализирующий 'CustomCellView *' с выражением типа UItableViewCell

Можете ли вы помочь мне понять и исправить ошибку ниже. Я не понимаю, как CustomCellView является подклассом UItableViewCell. Код компилируется, но предупреждение все еще существует:

Incompatible pointer type initializing 'CustomCellView *' with an expression of type `UItableViewCell`

Я получил вторую строку под заголовком hightlighted:

static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
4b9b3361

Ответ 1

static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell =(CustomCellView*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

вам нужно ввести приведение в ячейку

Ответ 2

static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

Ответ 3

Для пользовательской ячейки ниже код также отлично работает с заданным фреймом.

  CustomCell *cell= [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:nil] autorelease];