func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
if let pickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {
selectedImageArray.append(pickedImage)
}
dismissViewControllerAnimated(true, completion: nil)
}
我希望将选中的图像放入selectedImageArray中,但是没有得到图像。
答案 0 :(得分:0)
要获取已选择的图像,您必须使用 NSMutableArray
创建一个公共数组并在其中添加对象。
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject])
{
// assign pickup image into varibale
var selectedimage : UIImage!
if let editedImage = info[UIImagePickerControllerEditedImage] as? UIImage
{
selectedimage = editedImage
}
else
{
selectedimage = info[UIImagePickerControllerOriginalImage] as? UIImage
}
self.testArray.addObject(selectedimage)
}