Obj-C中的NSIndexPath警告

Bir*_*chi 3 objective-c nsindexpath

我在创建NSIndexPath时收到警告,

NSInteger arr[] = {0,3};
[NSIndexPath indexPathWithIndexes:arr length:2]
Run Code Online (Sandbox Code Playgroud)

warning: pointer targets in passing argument 1 of 'indexPathWithIndexes:length:' differ in signedness

是什么警告?如何使它工作?

谢谢

Mik*_*ike 5

假设您正在为iPhone开发,您应该使用用于创建索引路径的UIKit添加来表示位置UITableViews.您应该像这样构建您的示例:NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:0 inSection:3];有关详细信息,请参阅此Apple文档.


Ken*_*ner 5

您需要使数组为类型NSUInteger(无符号).

它告诉你,因为NSIndexPath不需要负值,你可能通过NSInteger数组传入(实际上是一个int).