I have two Objects, one is called CollidableController and the other is Collidable. Collidable controller creates Collidables and adds them to an array (which in this case is acting like a queue) but I'm struggling to add the UIImageView of the Collidable to the current View. It works fine before I add it to the array but I can't add the one that's in the array
Collidable *collidable = [[Collidable alloc] init:0];
[leftMovingBytesQueue enqueue:collidable];
//used a category to add this to NSMutableArray so it can act as a queue, this adds the 'collidable' object to the end of the array
[view addSubview:collidable.spriteImage];
collidable.spriteImage.center=CGPointMake(200, 200);
//adding the original collidable object's uiimageview to a view works fine
int length=[leftMovingBytesQueue count]-1;
[view addSubView:[leftMovingBytesQueue objectAtIndex:length].spriteImage];
//this line doesn't work, I get the error Semantic Issue: Property 'spriteImage' not found on object of type 'id'
NSMutableArrayhas a methodlastObject, which you may find useful.[leftMovingBytesQueue enqueue:collidable];. Try logging the type of thelastObjectafter this, and you may find the bug.NSLog(@"object type is: %@", [[leftMovingBytesQueue lastObject] class]);