Вопрос

Я получаю предупреждение, создавая NSIndexPath,

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

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

Что такое предупреждение из -за ?? Как заставить это работать?

Спасибо

Это было полезно?

Решение

You need to have the array be of type NSUInteger (unsigned).

It's telling you that because NSIndexPath does NOT want negative values, which you could potentially be passing in via an NSInteger array (really an int).

Другие советы

Assuming you're developing for the iPhone, you should use the UIKit additions intended for creating index paths to represent positions in UITableViews. You should construct your example like so: NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:0 inSection:3]; See this Apple documentation for more information.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top