Ответ 1
static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell =(CustomCellView*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
вам нужно ввести приведение в ячейку
Можете ли вы помочь мне понять и исправить ошибку ниже. Я не понимаю, как CustomCellView
является подклассом UItableViewCell
. Код компилируется, но предупреждение все еще существует:
Incompatible pointer type initializing 'CustomCellView *' with an expression of type `UItableViewCell`
Я получил вторую строку под заголовком hightlighted:
static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell =(CustomCellView*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
вам нужно ввести приведение в ячейку
static NSString *CellIdentifier = @"CustomCell";
CustomCellView *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
Для пользовательской ячейки ниже код также отлично работает с заданным фреймом.
CustomCell *cell= [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:nil] autorelease];