我想对此代码实施快速enumeration
,请帮助我。
int xx;
int b=0;
for (xx=0 ; xx<(distancearray.count); xx++) {
if ([NSNull null]!=[distancearray objectAtIndex:xx]&& 0 !=[[[distancearray objectAtIndex:xx] description] intValue] ) {
b++;
latitudeLabel.text=[NSString stringWithFormat:@" %d",b*100];
}
}
答案 0 :(得分:3)
试试这个:
for( id object in distancearray){
if ([NSNull null]!=object && 0 !=[[object description] intValue] ) {
b++;
latitudeLabel.text=[NSString stringWithFormat:@" %d",b*100];
}
}
答案 1 :(得分:0)
为简单起见:
for( id object in distancearray){
if (object && [[object description] intValue] != 0) {
b++;
latitudeLabel.text=[NSString stringWithFormat:@" %d",b*100];
}
}