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:
CGFloat locations[2] = {1.0, 0.0};
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):
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);
I tried creating a property like below in the .h
@property (nonatomic, assign) CGFloat locations;
and in the .m
@synthesize locations;
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 &"
you can get the project here is you feel like taking a look tinyurl.com/cmgy482 Any help much appreciated.