不兼容的指针类型,使用UItableViewCell类型的表达式初始化“CustomCellView *” [英] Incompatible pointer type initializing 'CustomCellView *' with an expression of type UItableViewCell

查看:163
本文介绍了不兼容的指针类型,使用UItableViewCell类型的表达式初始化“CustomCellView *”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能帮我理解和/解决下面的错误。我不明白,因为 CustomCellView UItableViewCell 的子类。代码被编译但警告仍然存在:

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 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];

您需要输入强制转换为您的单元格

这篇关于不兼容的指针类型,使用UItableViewCell类型的表达式初始化“CustomCellView *”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆