Assigning to 'CGPoint' (aka 'struct CGPoint') from incompatible type 'id'

ساخت وبلاگ

Vote count: 0

I have a NSMutableArray with CGPoint and when i try to add one of object to my CGPoint variable i have this error: Assigning to 'CGPoint' (aka 'struct CGPoint') from incompatible type 'id'

targetView.center = [arrayWithCoord objectAtIndex:1];

But i try the way which Xcode offer me:

targetView.center = *((__bridge CGPoint *)([arrayWithCoord objectAtIndex:1]));

And also i try something like this:

targetView.center = ((NSValue *)arrayWithCoord[0]).CGPointValue;

and all of this case i have target.center = {0 , 0}. I absolutely sure that array not empty. See my NSLog's

2016-08-17 00:41:40.760 newword[16497:819894] Element NSPoint: {154.5, 31}

2016-08-17 00:41:40.760 newword[16497:819894] Element NSPoint: {197.5, 31}

2016-08-17 00:41:40.760 newword[16497:819894] Element NSPoint: {240.5, 31}

2016-08-17 00:41:40.761 newword[16497:819894] target center result {0, 0}

Thanks for any help!

asked 49 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : assigning to cgpoint from incompatible type,assigning to cgpoint from incompatible type cgfloat, نویسنده : استخدام کار backsoft بازدید : 302 تاريخ : چهارشنبه 27 مرداد 1395 ساعت: 2:01