不兼容的指针类型Xcode
很抱歉对社区造成这样的负担,但我真的被困在这里了。
语义问题:不兼容的指针类型使用UITableViewCell *
类型的表达式初始化NewCustomCell *
UITableViewCell *
static NSString *cellID = @"customCell"; NewCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
[tableView dequeueReusableCellWithIdentifier:cellID]
返回类型为UITableViewCell *
的对象。 如果您知道单元格将始终是NewCustomCell *
类型,那么您可以告诉编译器期望使用NewCustomCell *
。 像这样:
NewCustomCell *cell = (NewCustomCell *) [tableView dequeueReusableCellWithIdentifier:cellID];
你必须施展它。
NewCustomCell *cell = (NewCustomCell *)[tableView dequeueReusableCellWithIdentifier:cellID];