【发布时间】:2011-05-06 10:18:02
【问题描述】:
我有一个 NSMutable 数组,并试图找到该数组中最后一个对象的索引号。这个我试过了,感觉很麻烦:
int currentCount = [[[self.myLibrary objectAtIndex:currentNoteBookNumber] tabColours] count];
NSLog(@"Number of tab colours total: %i", currentCount);
NSLog(@"Index number of last object: %i", currentCount-1);
还有其他方法吗?我的问题的上下文是我需要确定最后一个对象才能更改它:
replaceObjectAtIndex:[last object] withObject: ...
谢谢!
【问题讨论】:
标签: iphone objective-c cocoa-touch nsmutablearray