objective c - How to initialize a NSMutable array in a UIView subclass -
i create nsmutablearray , fill bunch coordinates.
i assign array property of array this:
draw.shapecoords = [shapes shapecoords];
where draw class , shapes class , shapecoords properties in both of them.
when drawrect method, array of coordinates empty. i'm did little research , found @synthesize not fully instantiate nsmutablearray, how in draw class (which implements uiview) initialize array? basically, need access data in array, how it?
@synthesize
doesn't instantiate object @ — creates variable (initialized nil) , accessor methods. need create array. in initwithframe:
, you'll want _shapecoords = [[nsmutablearray alloc] init]
.
Comments
Post a Comment