in CABasicAnimation.fromValue i want to convert a CGPoint to a "class" so i used NSValue valueWithPoint but in device mode or simulator one is not working... need to use NSMakePoint or CGPointMake if in device or simulator...
A:
Don't think of it as "converting" your point-- NSValue is a wrapper class that holds primitive structs like NSPoint. Anyway, here's the function you need. It's part of Cocoa, but not Cocoa Touch. You can add the entire function to your project, or just do the same conversion wherever you need it.
NSPoint NSPointFromCGPoint(CGPoint cgpoint) {
return (*(NSPoint *)&(cgpoint));
}
Marc Charbonneau
2009-04-21 15:12:46
Can you please explain the syntax used in your reply? Looks useful.
Dimitris
2010-08-31 13:55:05
+7
A:
There is a UIKit additon to NSValue that defines a function
+ (NSValue *)valueWithCGPoint:(CGPoint)point
See iPhone doc
ashcatch
2009-04-21 15:24:28