目前我有一个符合 NSCoding 的类,其中包含 UIBezierPath 和 UIColor。
required init(coder aDecoder: NSCoder) {
super.init()
self.lineColor = aDecoder.decodeObjectForKey("color") as! UIColor
self.bezierPath = aDecoder.decodeObjectForKey("bezier") as! UIBezierPath
}
func encodeWithCoder(aCoder: NSCoder) {
aCoder.encodeObject(lineColor, forKey: "color")
aCoder.encodeObject(bezierPath, forKey: "bezier")
}
我通过 NSKeyedArchiver 实现了这一点
NSKeyedArchiver.archivedDataWithRootObject(path)
并将其保存在服务器上(parse.com) 我可以在 iOS 上毫无问题地解压它。但如何兼容Android呢?
最佳答案
我同意韦恩的观点。您可以调用 self.bezierPath.CGPath 来检索 CGPath,然后您可以使用以下答案将其放入 SVG。
然后您可以以中性格式发送它。
关于android - UIBezierPath 到 NSData 到服务器到 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30998142/