【发布时间】:2017-11-12 00:28:31
【问题描述】:
所以我在导航控制器内,想在按下按钮时显示一个图像选择器。这很好用,但是当我关闭选择器时,它会将我扔回根视图控制器,而不是我想要处理图像的地方。
这是我的代码:
@IBAction func attachPhotoButtonPressed(sender: UIButton) {
imagePicker.sourceType = .SavedPhotosAlbum
presentViewController(imagePicker, animated: true, completion: nil)
}
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
if let image = info[UIImagePickerControllerOriginalImage] as? UIImage {
print("Success")
} else{
print("Something went wrong")
}
self.dismissViewControllerAnimated(true, completion: nil)
}
我已经查看了这些问题,但没有找到解决方法。 (不是 Objective-C 的家伙)
Pushing a navigation controller is not supported- performing segues
presenting ViewController with NavigationViewController swift
【问题讨论】:
标签: ios swift uinavigationcontroller segue uiimagepickercontroller