【发布时间】:2017-06-25 04:49:57
【问题描述】:
如果我在保存之前使用图像,这是正常的。但是如果我保存它并稍后使用它是 90 度转动。如何确保它不会横向保存?
func saveEvent(_ center1: CLLocation, title2: String, imagePicked1: UIImage)
{
let data = UIImagePNGRepresentation(imagePicked1);///
let url = NSURL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(NSUUID().uuidString+".dat")
do {
try data!.write(to: url!, options: [])
} catch let e as NSError {
print("Error! \(e)");
return
}
let image11 = CKAsset(fileURL: url!)
self.eventRecord.setObject(image11 as CKAsset, forKey: "Picture")
let publicData = CKContainer.default().publicCloudDatabase
publicData.save(self.eventRecord, completionHandler: { record, error in
if error == nil
{
print("Image saved")
}else{
print(error!)
}
})
}
【问题讨论】:
-
只需使用 JPEG,您的旋转就可以了
-
我该怎么做@LeoDabus
-
是或将其保存为 JPEG @LeoDabus
-
JPEG 运行良好,谢谢
标签: ios swift uiimage png uiimagepickercontroller