So I’m trying to create some graphs using Core Plot, but for the following lines of code:
CPTLineStyle *lineStyle = [[[CPTLineStyle lineStyle] alloc] init];
[lineStyle lineColor] = [CPTColor blackColor];
[lineStyle lineWidth] = 2.0f;
I’m getting an “Assignment to readonly property” error (for the second and thir lines), when clearly lineColor and lineWidth are assignable properties. I’ve been racking my brain about this for some time now, so hopefully someone knows what the issue might be.
You need to use CPTMutableLineStyle, all of the properties in CPTLineStyle are read-only and can only be set when initializing the LineStyle.
And your syntax for setting the properties is wrong.