NSPredicate 數據過濾
http://www.lxweimin.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 模型數組深拷貝,對象深拷貝
http://www.lxweimin.com/p/a75fc0677036
深copy、淺copy
http://www.lxweimin.com/p/359b757d3430
NSArray 總結
https://www.cnblogs.com/dreamWanweidong/p/4998716.html
iOS獲取數組的最大值
http://www.lxweimin.com/p/3cdae30f7cb0
數組排序
https://www.cnblogs.com/tig666666/p/8474445.html