开发者

Objective-C Loop Through NSMutableArray?

Very simple question - how might I iterate through a NSMutableArray and do things for each item?

开发者_Python百科

Much like the for loop in other langs:

foreach(array)
{
    dosomething();
}


If you want to call a method in each one, use

[array makeObjectsPerformSelector:@selector(eatFish)];

or if you want to pass an argument,

[array makeObjectsPerformSelector:@selector(eat:) withObject:myFishObject];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜