3

我在创建 NSIndexPath 时收到警告,

NSInteger arr[] = {0,3};
[NSIndexPath indexPathWithIndexes:arr length:2]

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

警告是由于什么原因??如何让它发挥作用?

谢谢

4

2 回答 2

5

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

于 2010-01-11T04:15:55.127 回答
5

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

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

于 2010-01-11T04:16:15.093 回答