0
我试图更新parse.com中的图像存储。我在我的视图上有一个imageview,并且该imageview上有一个默认图像。我可以从图书馆中选择照片,并且可以使用我从图书馆中选择的照片更改我的图像浏览图像。但仍然我的代码保存默认图像来解析,而不是我从库中选择的图像。如何安排哪部分代码首先工作
func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
self.dismissViewControllerAnimated(true, completion: nil)
profileImage.image = image
}
var objectIds = [String]()
@IBAction func changePp(sender: AnyObject) {
var image = UIImagePickerController()
image.delegate = self
image.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
image.allowsEditing = false
self.presentViewController(image ,animated: true,completion: nil)
var queryU = PFQuery(className:"ProfilePhoto")
queryU.getObjectInBackgroundWithId(self.objectIds[0]) {
(Pp: PFObject?, error: NSError?) -> Void in
if error != nil {
print(error)
} else if let Pp = Pp {
let imageData = UIImagePNGRepresentation(self.profileImage.image!)
let imageFile = PFFile(name: "pImage.png",data: imageData!)
Pp["profilePhoto"] = imageFile
Pp.saveInBackground()
}
}
}
从库中选择照片并设置为我的imageview后,如何提供保存解析过程?
Happy programming dude :) –