1

I have a UIImageView in my storyboard, and the user can successfully select an image from their phone to place in the ImageView; however, I'm not sure how to get that from the storyboard to Parse.com.

Any code would be much appreciated. There are lots of tutorials on downloading, but not saving initially.

Mason Ballowe
  • 1,847
  • 2
  • 12
  • 23
  • 1
    You can't save an image view, and the storyboard doesn't matter. You need to get the image data and create the `PFFile`, give that a try. – Wain Apr 29 '15 at 13:53
  • so I need to convert the image from the storyboard into NSData? then to a PFFile? – Mason Ballowe Apr 29 '15 at 13:59
  • You said they select an image from the phone, the storyboard has nothing to do with that – Wain Apr 29 '15 at 14:06

1 Answers1

5

You need to take the image out of the UIImageView and sage it to a PFFile.

var file = PFFile(data: UIImageJPEGRepresentation(imageView.image, 1.0))

Then of course, you can upload the file somewhere you choose.

Schemetrical
  • 5,506
  • 2
  • 26
  • 43
  • thank you for the help! this worked perfectly. Now I just need to shrink the size some. I'll try modifying that 1.0 to 0.5 or something – Mason Ballowe Apr 30 '15 at 13:34