【发布时间】:2013-12-18 19:30:16
【问题描述】:
我已将 UITableViewCell 子类化以创建自定义单元格。在 ViewController 上,我添加了 UITableView 和原型单元格。我的自定义单元格出现并且工作正常。
但是在我的 didSelectRowAtIndexPath 和 didDeselectRowAtIndexPath 方法中出现了一个警告,我无法摆脱它。
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath {
MVGoalTVCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
NSString *cellText = cell.txtBox.text;
LogInfo(@"DESELECTED: %@", cellText);
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
MVGoalTVCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
NSString *cellText = cell.txtBox.text;
LogInfo(@"SELECTED: %@", cellText);
}
警告出现在一行:
MVGoalTVCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
我在 MVGoalTVCell 中引用我的自定义单元格。
出现的警告如下:
使用“UITableViewCell *”类型的表达式初始化“MVGoalTVCell *”的不兼容指针类型
如何解决此警告?
【问题讨论】:
标签: uitableview ios7 didselectrowatindexpath