我有这个传统的for循环,我想转换为快速枚举。我怎样才能做到这一点?谢谢!
for (int i = 0; i < [_objects count]; i++)
{
schedule = [[JSSchedule alloc] initWithDictionary:_objects[i]];
}
答案 0 :(得分:3)
使用此
for(NSDictionary *object in _objects)
{
schedule = [[JSSchedule alloc] initWithDictionary: object];
}
答案 1 :(得分:0)
像这样:
for (id object in _objects)
{
schedule = [[JSSchedule alloc] initWithDictionary: object];
}