ios - 从 UIImagePickerController 继续

标签 ios objective-c uiimagepickercontroller segue

我正在尝试从 UIImagePickerController 转到另一个 View Controller 。

我尝试过推送转接,因为我知道 UIImagePickerController 是 UINavigationController 的子类,但它没有用。错误是“Push segues 只能在源 Controller 由 UINavigationController 的实例管理时使用。”

现在我尝试模式转场,但是当它发生时,屏幕变黑了。

这两个问题之间是否存在联系,请问我该怎么做?

最佳答案

您不能直接从 UIImagePickerController 执行 segue。

尝试从实例化 UIImagePickerController 的 View Controller 添加一个推送 segue 到目标 VC。

现在在源 VC 中实现 UIImagePickerControllerDelegate 方法 didFinishPickingMediaWithInfo: 并在该方法中调用 self performSegueWithIdentifier: sender: segue,你最近创建了。

当然,您需要为segue设置一个标识符,并在您的源VC头接口(interface)中添加UINavigationControllerDelegate、UIImagePickerControllerDelegate协议(protocol)引用。

如果您需要将一些数据(例如图像信息)传递给目标 VC,您可能还需要在源 VC 中实现 prepareForSegue: 方法。

关于ios - 从 UIImagePickerController 继续,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19988493/

相关文章:

ios - ViewController 中的 Swift 错误 "Use of undeclared type"

ios - “发布”不可用 : not available in automatic reference counting mode

iphone - iOS 中 UI 控件状态管理的设计模式

objective-c - 从 "visible"区域或窗口获取 UITableviewCell 位置

iphone - 关闭相机 View 会使应用程序崩溃

uiimagepickercontroller - 相机无法通过请求 CAMMutableStillImageCaptureRequest 捕获静止图像

ios - Corner by UIBezierPath for flexible View (View can be increase width height by content)

ios - 在 Swift 应用程序中安装 Realm

ios - 可重用的 UICollectionViewCell 不刷新

ios - 向 UIImagePickerController 的工具栏添加一个 "Pick from Photo Library"按钮