問題:無限循環導致UI界面卡死,不停打印1,但是沒想明白為什么?有知道的兄臺請指點指點,第一次打印favMenuArray.count = -1,執行到for循環就變成了很大的數字,導致死循環
NSArray * favMenuArray = [[NSArray alloc] init];
NSLog(@"%ld",favMenuArray.count);
for (int i = 0; i< favMenuArray.count-1; i++) {
NSLog(@"打印1");
for (int j = i+1; j <favMenuArray.count; j++) {
NSLog(@"打印2");
}
}
屏幕快照 2018-01-06 下午6.02.01.png