错误信息:
cast of ‘int’ to “NSIndexPath *’ is disallowed with ARC
码:
NSInteger CurrentIndex; [self tableView:(UITableView *)horizontalTableView1 didSelectRowAtIndexPath:(NSIndexPath *)int_CurrentIndex];
解决方法
您不能直接将int变量转换为NSIndexPath.但是你可以从一个int变量中创建一个NSIndexPath.
您需要一个部分索引和行索引来创建一个NSIndexPath.如果你的UITableView只有一个部分,那么:
Objective-C的
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
迅速
let indexPath: NSIndexPath = NSIndexPath(forRow: rowIndex,inSection: 0)