NSPredicate 数据过滤
https://www.jianshu.com/p/a56addca1c6b
https://blog.csdn.net/lovechris00/article/details/78227305
数组
####------------批量设置数组的某个值(不用循环)
[arr setValue:@0 forKeyPath:@"isSelect"];
####------------倒序
NSArray* reversedArray = [[array reverseObjectEnumerator] allObjects];
####------------插入到第一个元素
[array insertObject:@"fff" atIndex:0];
####------------删除指定数组
NSMutableArray *array = [NSMutableArray array];
[array removeObjectsInArray:selectArray];
####------------深拷贝数组
[self.doctorArr mutableCopy]
排序
####------------冒泡排序
for (int i=0; i<imgArr.count-1; i++)
{
for (int j=i+1; j<imgArr.count; j++) {
if (imgArr[i] > imgArr[j]) {
NSString *TempDic=[[imgArr objectAtIndex:i]copy];
imgArr[i] = [[imgArr objectAtIndex:j] copy];
imgArr[j]=TempDic;
}
}
}
遍历
for (int i = 0; i<arr.count;i++) {
NSLog(@"obj = %@", arr[i]);
}
for (NSString *obj in arr) {
NSLog(@"obj = %@", obj);
}
// 每取出一个元素就会调用一次block
// 每次调用block都会将当前取出的元素和元素对应的索引传递给我们
// obj就是当前取出的元素, idx就是当前元素对应的索引
// stop用于控制什么时候停止遍历
[arr enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if (idx == 1) {
*stop = YES;
}
NSLog(@"obj = %@, idx = %lu", obj, idx);
}];
iOS 模型数组深拷贝,对象深拷贝
https://www.jianshu.com/p/a75fc0677036
深copy、浅copy
https://www.jianshu.com/p/359b757d3430
NSArray 总结
https://www.cnblogs.com/dreamWanweidong/p/4998716.html
iOS获取数组的最大值
https://www.jianshu.com/p/3cdae30f7cb0
数组排序
https://www.cnblogs.com/tig666666/p/8474445.html