2010-01-11 89 views
3

我得到在創建NSIndexPath警告,NSIndexPath警告的對象 -

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

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

什麼是由於警告?如何使它工作?

感謝

回答

5

您需要讓該陣列的類型爲NSUInteger(無符號)。

它告訴你,因爲NSIndexPath不希望負值,你可能會通過一個NSInteger數組(真的是一個int)傳入。

+0

謝謝...它的工作。 – Biranchi 2010-01-11 05:13:21

5

假設你正在爲iPhone開發,你應該使用用於創建索引路徑來代表UITableViews位置的UIKit增加。您應該像這樣構建您的示例:NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:0 inSection:3];有關更多信息,請參閱this Apple documentation

+1

這只是iPhone,但他沒有在標籤中指定iPhone ... – 2010-01-11 04:16:48