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

前端 未结 3 1932
灰色年华
灰色年华 2021-02-07 04:16

Can you help me understandand/fix the error below. I don\'t understand as CustomCellView is a subclass of UItableViewCell. The code gets compiled but t

相关标签:
3条回答
  • 2021-02-07 04:37

    For custom cell below code is also working fine with given frame..

      CustomCell *cell= [[[CustomCell alloc] initWithFrame:CGRectZero reuseIdentifier:nil] autorelease];
    
    0 讨论(0)
  • 2021-02-07 04:41
    static NSString *CellIdentifier = @"CustomCell";
    CustomCellView *cell =(CustomCellView*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    

    you need to type cast to your cell

    0 讨论(0)
  • 2021-02-07 04:44
    static NSString *CellIdentifier = @"CustomCell";
    CustomCellView *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
    
    0 讨论(0)
提交回复
热议问题