objective c - How to reference a specific instance of an object created by a function? Obj-C -


good day all, i'm pretty confused on how to, instance, change property of object created function. calling function multiple times created multiple instances of same class same object name, want change properties of single specific object. guess little background helpful folks: started play around in cocos2d chipmunk engine iphone , in example project can create character on screen multiple time calling method. want control forces applied 1 specific character. if need more specific example please ask! thank =)

you should create nsmutablearray store objects:

nsmutablearray *myarray = [[nsmutablearray alloc] init]; for(int i=0; i< 5; i++){    ........    // create object here    ........    [myarray addobject:yourobject]; } 

after can access object using this:

id myobject = [myarray objectatindex:1] 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -