title: Creating a property from a CGFloat array - iOS
body: <p>Trying to create a property, so I can set CGfloat array values on an instance of a class. Having a hard time figuring out how to do it. The CGFloat needs to have "size" [2] variable and numeric components like below:</p>
  
  <pre><code>CGFloat locations[2] = {1.0, 0.0};
  </code></pre>
  
  <p>Here is how it looks in the class itself (this works), before I created the property  in an attempt to set these values from an instance (this creates a gradient BTW via drawRect in a UIView sunclass):</p>
  
  <pre><code>CGContextRef context = UIGraphicsGetCurrentContext();
  CGColorSpaceRef myColorspace=CGColorSpaceCreateDeviceRGB();
  CGFloat locations[2] = {1.0, 0.0};
  CGFloat components[8] = { 1.0, 0.0, 0.0, 1.0,  0.5, 0.25, 1.0, 1.0 };
  CGGradientRef myGradient = CGGradientCreateWithColorComponents(myColorspace, components,locations, num_locations);
  CGContextDrawLinearGradient (context, myGradient, myStartPoint, myEndPoint, 0);
  </code></pre>
  
  <p>I tried creating a property like below in the .h</p>
  
  <pre><code>@property (nonatomic, assign) CGFloat locations;
  </code></pre>
  
  <p>and in the .m</p>
  
  <pre><code>@synthesize locations;
  </code></pre>
  
  <p>But I cant figure out how to properly set the values for the [size] and the components from the instance. Also I get errors when I set up the property: ERROR: "Passing 'CGFloat' (aka 'float') to parameter of incompatible type 'const CGFloat *' (aka 'const float *'); take the address with &amp;"</p>
  
  <p>you can get the project here is you feel like taking a look <a href="http://tinyurl.com/cmgy482" rel="nofollow">tinyurl.com/cmgy482</a> Any help much appreciated.</p>