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 に答える