NSIndexPath警告中的OBJ-C
-
19-09-2019 - |
题
我得到一个警告在创建NSIndexPath,
NSInteger arr[] = {0,3};
[NSIndexPath indexPathWithIndexes:arr length:2]
warning: pointer targets in passing argument 1 of 'indexPathWithIndexes:length:' differ in signedness
什么是由于警告??如何使它工作?
由于
解决方案
您需要有该阵列是类型NSUInteger
的(无符号)。
它告诉你,因为NSIndexPath不希望负值,您可能会通过一个NSInteger阵列(真是一个int)。
被传递其他提示
假设你正在为iPhone开发时,你应该使用用于创建索引路径来代表UITableViews
位置的UIKit增加。你应该建立你的榜样,像这样:NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:0 inSection:3];
见的此苹果文档获得更多信息
不隶属于 StackOverflow