Is there an easy way to iterate over an NSArray backwards?

前端 未结 5 1658
半阙折子戏
半阙折子戏 2020-12-29 01:57

I\'ve got an NSArray and have to iterate over it in a special case backwards, so that I first look at the last element. It\'s for performance reasons: If the la

5条回答
  •  情歌与酒
    2020-12-29 02:37

    for (int i = ((int)[array count] - 1); i > -1; i--) {
        NSLog(@"element: %@",array[i]);
    }
    

提交回复
热议问题