iosobjective-cpointersnsarraycgfloat

ios objective-c const CGFloat *


when I am calling

setLineDash:(nullable const CGFloat *) count:(NSInteger) phase:(CGFloat)

method by passing @[@1.0,@2.0] as (nullable const CGFloat *)

UIBezierPath *path = [self drawLine:start ended:ended];
[path setLineDash:@[@1.0, @2.0] count:2 phase:0.0];

I am keep getting this error;

Implicit conversion of an Objective-C pointer to 'const CGFloat * _Nullable' (aka 'const double *') is disallowed with ARC

any suggestion? what's the right argument to pass in here.

appreciated.


Solution

  • Try this

    CGFloat dash_pattern[]={1.0,2.0};
    [path setLineDash:dash_pattern count:2 phase:0.0];