rihekopo
rihekopo

Reputation: 3350

Calling method after for loop is finished

I have a simple for loop that adds objects to an NSMutableArray what I need to utilize in a method after the loop finished. I would like to know that how can I detect when the for loop is "ready"? Or the [map addAnnotations:self.nameList]; won't get called until the loop is running so I don't need to care about it?

    if (objects) {

        for (PFObject *obj in objects) 
        {

            [self.nameList addObject:obj[@"name"]];

        }

           [map addAnnotations:self.nameList];

     }

Upvotes: 1

Views: 151

Answers (1)

asifmohd
asifmohd

Reputation: 999

Most of the executions are sequential in nature, therefore the for loop will be completed first, then the [map addAnnotations: self.nameList]; method will be called.

So you don't need to care about it.

Upvotes: 3

Related Questions