如何从Swift beta 3中的UIImagePickerControllerDelegate获取UIImage?

时间:2014-07-16 16:20:14

标签: ios swift swift3 uiimagepickercontroller

我找到了一些相关的帖子:

UIImagePickerControllerDelegate to Swift?

how to capture camera with UIImagePickerController in swift?

但它们都不适用于beta 3,因为UIImagePickerControllerDelegate已更改:

func imagePickerController(picker: UIImagePickerController!, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]!)

我的问题是如何从info Array获取UIImage对象?感谢

1 个答案:

答案 0 :(得分:5)

它是一个字典,用UIImagePickerControllerOriginalImage

索引它
let image = info[UIImagePickerControllerOriginalImage] as UIImage