Saturday, 6 August 2011

Can't have array in @property?

Was following this You Tube Video "Making a simple iPhone game, part 2 by TheEagle1100 (DBaird Software), but I tried to do it in slightly different way. Instead of declaring 5 UIImageView calling them "*platform1" to "*platform5", I used an array to save the effort of duplicating.

However when I put in declaration for @property as below, as shown in screen dump above I get 2 errors. 1st about "Property cannot have array or function type 'UIImageView *[5]", the 2nd one says "Property with 'retain' attribute must be of object type.

@property (nonatomic, retain) IBOutlet UIImageView *platform[5];

If I remove the "retain" it will get rid of the 2nd error, but the first error remains....

Based on my "limited" understanding of how "@property" works, it's mainly for the getter and setters, so may be I have to write my own getter/setter or try some other way...

No comments:

Post a Comment