基本上,我是在NSInteger中存储数组的索引.我现在需要它作为NSIndexpath,我正在努力查看并找到一种方法将我的NSInteger转换为NSIndexpath,以便可以重用它.
基本上,我是在NSInteger中存储数组的索引.我现在需要它作为NSIndexpath,我正在努力查看并找到一种方法将我的NSInteger转换为NSIndexpath,以便可以重用它.
对于整数index
:
NSIndexPath *path = [NSIndexPath indexPathWithIndex:index];
根据the reference创建 node 0中要指向的项的索引.
要在UITableView
中使用indexPath,更合适的方法是
NSIndexPath *path = [NSIndexPath indexPathForRow:row inSection:section];