http://www.jianshu.com/p/e71cec144966
确实很方便
-(void)splitArray{
if(self.unReadmsgModule){
if (self.module.showingMessages.count>self.unReadmsgModule.unReadmsgCount) {
NSIndexSet * unreadIndexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(self.module.showingMessages.count-self.unReadmsgModule.unReadmsgCount, self.unReadmsgModule.unReadmsgCount)];
NSIndexSet * readIndexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, self.module.showingMessages.count-self.unReadmsgModule.unReadmsgCount)];
self.module.unReadMsgArray = [[NSMutableArray alloc]initWithArray:[self.module.showingMessages objectsAtIndexes:unreadIndexSet]];
self.module.readMsgArray = [[NSMutableArray alloc]initWithArray:[self.module.showingMessages objectsAtIndexes:readIndexSet]];
}else{
self.module.unReadMsgArray = self.module.showingMessages;
}
}
数组的拆分