インデックス パスを使用したいデータ状況があります。データをトラバースしているときに、NSIndexPath の最後のノードをインクリメントしたいと考えています。私がこれまでに持っているコードは次のとおりです。
int nbrIndex = [indexPath length];
NSUInteger *indexArray = (NSUInteger *)calloc(sizeof(NSUInteger),nbrIndex);
[indexPath getIndexes:indexArray];
indexArray[nbrIndex - 1]++;
[indexPath release];
indexPath = [[NSIndexPath alloc] initWithIndexes:indexArray length:nbrIndex];
free(indexArray);
これは少し不格好に感じます - もっと良い方法はありますか?