avvertenze NSIndexPath in Obj-C
-
19-09-2019 - |
Domanda
sto ottenendo un messaggio di avviso durante la creazione del NSIndexPath,
NSInteger arr[] = {0,3};
[NSIndexPath indexPathWithIndexes:arr length:2]
warning: pointer targets in passing argument 1 of 'indexPathWithIndexes:length:' differ in signedness
Qual è l'avvertimento a causa ?? Come farlo funzionare?
Grazie
Soluzione
È necessario avere la matrice sia di tipo NSUInteger
(non firmato).
E si sta dicendo che a causa NSIndexPath NON vuole valori negativi, che si potrebbe potenzialmente essere passando attraverso una serie NSInteger (davvero un int).
Altri suggerimenti
Supponendo che si sta sviluppando per l'iPhone, è necessario utilizzare le aggiunte UIKit destinati per la creazione di percorsi di indice per rappresentare posizioni in UITableViews
. Si dovrebbe costruire il vostro esempio in questo modo: NSIndexPath *myIndexPath = [NSIndexPath indexPathForRow:0 inSection:3];
Vedere questa documentazione Apple per ulteriori informazioni