【发布时间】:2013-04-04 18:15:42
【问题描述】:
我在 iOS 开发方面还不太成熟,并且不断收到我不确定的警告。
我在表格视图中使用自定义单元格,并将其类设置为 UITableViewCell 的子类,称为 SiteCell。在我的“didSelectRowAtIndexPath”方法中,当我将所选单元格声明为 SiteCell 类型时,我收到以下警告:
使用不兼容的指针类型初始化 SiteCell __strong UITableViewCell 类型的表达式
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
SiteCell *cell = [tableView cellForRowAtIndexPath:indexPath];
NSString *rowIdentity = [NSString stringWithFormat:@"%d", indexPath.row];
[selectedRows setObject:[cell.siteTitleLabel text] forKey:rowIdentity];
if(cell.accessoryType == UITableViewCellAccessoryCheckmark){
cell.accessoryType = UITableViewCellAccessoryNone;
}else{
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
}
任何人都可以阐明如何消除此警告吗?
【问题讨论】:
标签: objective-c types variable-assignment compiler-warnings