I am getting an error that I don’t understand how to fix. The error is:
Sending 'CGFloat' (aka 'float') to parameter of incompatible type 'CGFloat *' (aka 'float *');
For line:
[xlabel.text drawAtPoint:CGPointMake(labelRect.origin.x, labelRect.origin.y)
forWidth:labelRect.size.width
withFont:myFont
minFontSize:5.0
actualFontSize:myFont.pointSize
lineBreakMode:UILineBreakModeWordWrap
baselineAdjustment:UIBaselineAdjustmentAlignCenters];
the error points to actualFontSize:myFont.pointSize. myFont is a UIFont. I set it like so: UIFont *myFont = [UIFont systemFontOfSize:17.0];
What does that error mean and any ideas on how to fix it?
From the docs:
Which means that you have to pass in a pointer, by referencing a variable. To do so you use the ampersand operator
&Example:
drawAtPoint: will set the value that outSize points to and so you can print the result.
The reason for this here is, that you can only return 1 value in C via return statement. To get multiple results, you can pass in pointers to allow the method to set additional results.