Reputation: 4056
How do you cast or create a CGFloat from a float?
I get a bad receiver type float * error.
CGFloat point = [graphValues objectAtIndex:0];
Upvotes: 1
Views: 3094
Reputation:
That's because the array is not an NSArray
but a float
array.
CGFloat point = graphValues[0];
If you want to know how CGFloat
is declared, have a look in the header (it should be a double
).
Upvotes: 2
Reputation: 28242
graphValues
is probably not an NSArray
, but a C-array of float
s. If so, you want this:
CGFloat point = graphValues[0];
(The reason I think this is because it's telling you you're trying to call an Objective-C method on a float *
.)
Upvotes: 3