Swift - UIImagePickerController - how to use it?

前端 未结 5 2083
天涯浪人
天涯浪人 2020-12-05 02:05

I am trying hard to understand how this works, but it\'s pretty hard for me. =) I have 1 view, there is one button and one small ImageView area for preview. The button trigg

5条回答
  •  猫巷女王i
    2020-12-05 02:19

    Try this:

    func imagePickerController(picker: UIImagePickerController!, didFinishPickingMediaWithInfo info:NSDictionary!) {
        let tempImage = info[UIImagePickerControllerOriginalImage] as! UIImage
        imagePreview.image  = tempImage
    

    or you can also use ? in place of !.

提交回复
热议问题