0

I create an NSMutableArray and fill it with a bunch coordinates.

I assign the array to the property of another array like this:

draw.shapeCoords = [shapes shapeCoords];

Where draw is a class and shapes is a class and shapeCoords are properties in both of them.

When I get to my drawRect method, the array of coordinates is empty. I'm did a little research and found that the @synthesize does not fully instantiate an NSMutableArray, how then in my draw class (which implements UIView) do I initialize the array? Basically, I need access to the data in the array, how do I get it?

4

1 回答 1

2

@synthesize根本不实例化一个对象——它只是创建一个变量(初始化为 nil)和访问器方法。您需要实际创建数组。在你的initWithFrame:,你会想要类似的东西_shapeCoords = [[NSMutableArray alloc] init]

于 2013-04-17T23:25:09.773 回答