Objective-C NSMutableArray - foreach loop with objects of multiple classes -


I have NSMutableArray * in the datastructure-class "Foo", which is the "super 1" And "Bar 2" that array bar gives 1 and 2 time objects to get recursive parent-children-structure just like a tree of sub-squares. To use objects in the array, I use the loop through them using the foreach loop in Objective-C:

  (Foo * aufoo in children) {...} / Code>  

But often I just need to loop through objects in a specific class array, in this case I want to do one thing for each object of class 1 in array children. (For the time in the object 1 * for the children) loop through all the objects and not only with Class Bar1 what is the need to get me what I need?

You have to loop all the objects and check inside a type loop.

 for  (id aufoo in children) {if ([aufoo iskindoff class: [bar 1 class]]) ...}}  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -