for(LevelMeter *thisMeter in _subLevelMeters){
{
xxxxx
}
I am new to iPhone development. I am doing research on voice recording in iphone. I have downloaded the "speak here" sample program from Apple.
I came across the above code in the sample program. I can’t understand the for loop. LevelMeter is separate class. _subLevelMeters is a NSArray. They have used "in" inside for loop.
What is the function of the above for loop?
_subLevelMetersis an NSArray that contains a number of LevelMeter objects.The syntax being used here is Objective-C 2.0’s fast enumeration.
Basically, it’s like saying “for each LevelMeter object in the _subLevelMeters array, do this code”. Or to put it a in more colloquial fashion: “Do this stuff for each LevelMeter in the array”.
Hope that helps.