我是Swift的完全新手,在网络上什么也没找到。如何转换以这种方式格式化的字符串:
let str:String = "0,0 624,0 624,-48 672,-48 672,192"
到CGPoint的数组?
此解决方案使用CGPointFromString
iOS提供的功能。
import UIKit
let res = str
.components(separatedBy: " ")
.map { CGPointFromString("{\($0)}") }
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句