错误信息:
ARC不允许将"int"转换为"NSIndexPath*"
码:
NSInteger CurrentIndex;
[self tableView:(UITableView *)horizontalTableView1 didSelectRowAtIndexPath:(NSIndexPath *)int_CurrentIndex];
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?
The*_*ger 69
您不能直接将int变量强制转换为NSIndexPath.但你可以NSIndexPath从int变量中创建一个.
你需要一个section索引和row索引来制作一个NSIndexPath.如果你UITableView只有一个section那么:
Objective-C的
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:rowIndex inSection:0];
Run Code Online (Sandbox Code Playgroud)
迅速
let indexPath: NSIndexPath = NSIndexPath(forRow: rowIndex, inSection: 0)
Run Code Online (Sandbox Code Playgroud)
斯威夫特4
let indexPath = IndexPath(row: rowIndex, section: 0)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23923 次 |
| 最近记录: |