开发者

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

开发者 https://www.devze.com 2023-04-04 03:57 出处:网络
Can you help me understandand/fix the error below. I don\'t understand as CustomCellVie开发者_运维技巧w is a subclass of UItableViewCell. The code gets compiled but the warning is still there:

Can you help me understandand/fix the error below. I don't understand as CustomCellVie开发者_运维技巧w is a subclass of UItableViewCell. The code gets compiled but the warning is still there:

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

I got the 2nd line below hightlighted:

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


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

you need to type cast to your cell


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

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


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

精彩评论

暂无评论...
验证码 换一张
取 消