正如我的问题标题所述,我如何将 CGPoint
转换为 NSValues
以便我可以将其存储到 swift 中的数组中。
在 objective-C 中我们可以这样做:
// CGPoint converted to NSValue
CGPoint point = CGPointMake(9, 9);
NSValue *pointObj = [NSValue valueWithCGPoint:point];
但是谁能告诉我如何快速完成此操作?
提前致谢。
最佳答案
尝试这样的事情:
let point = CGPointMake(9, 9)
var pointObj = NSValue(CGPoint: point)
关于ios - 如何快速转换NSValue中的CGPoint?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26251678/