- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我有一个 UITableViewCell
按钮可以拍摄图像并将其放回单元格中。当我调用 UIImagePickerController
并拍摄图像时,它不会调用以下委托(delegate):
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject], sender:AnyObject)
这是我在 UITableViewController
中的 takePhotoFunction
:
@IBAction func takePhoto(sender: AnyObject) {
let imagePickerController = UIImagePickerController()
imagePickerController.delegate = self
imagePickerController.allowsEditing = true
let actionSheet = UIAlertController(title: "Choose image souruce", message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet)
actionSheet.addAction(UIAlertAction(title: "Take Image", style: UIAlertActionStyle.Default, handler: { (alert:UIAlertAction!) -> Void in
imagePickerController.sourceType = UIImagePickerControllerSourceType.Camera
self.presentViewController(imagePickerController, animated: true, completion: nil)
}))
actionSheet.addAction(UIAlertAction(title: "Photo Library", style: UIAlertActionStyle.Default, handler: { (alert:UIAlertAction!) -> Void in
imagePickerController.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
self.presentViewController(imagePickerController, animated: true, completion: nil)
}))
actionSheet.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))
self.presentViewController(actionSheet, animated: true, completion: nil)}
最佳答案
在 Swift 3 中,这个委托(delegate)方法现在被称为:
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])
区别是:
我遇到了同样的问题,当我进行这些更改时它起作用了。
关于ios - didFinishPickingMediaWithInfo 未调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29189548/
我在我的应用程序中使用 UIImagePickerViewController 拍照,但是在支持多任务处理的 iOS4+ 中,我遇到了内存问题。如果您打开了很多应用程序,然后又打开了我的应用程序,则
我正在努力使用 捕获 4.0 中返回的图像 - (void)imagePickerController:(UIImagePickerController *)picker didFinishP
我基本上是在尝试从用户照片库(或相机)中“获取”图像。 问题是,在 iPad 上(兼容模式)时没有返回图像。 这是代码: - (void)imagePickerController:(UIImageP
我想知道是否有办法让 didFinishPickingMediaWithInfo 方法根据发件人执行不同的操作。 例如: 在一个ViewController中,我有一个相机按钮,当用户完成拍照时,di
我认为 UIImagePickerController 委托(delegate)方法(或任何 UIKit 委托(delegate)方法)在主线程中被调用。但是在这里,当从图库或相机中选取图像时,did
我正在尝试在imagePickerController:didFinishPickingMediaWithInfo中管理图像旋转,但经过多次尝试,我没有找到任何解决方案。我最后的尝试是: -(void
我正在将旋转轮按钮实现为我的相机中的录制按钮。但是在单击旋转 DidFinish 方法的中心按钮时没有调用。 旋转轮的使用来自 http://www.raywenderlich.com/9864/ho
它看起来像 didFinishPickingMediaWithInfo 函数正在进行无限循环,它最终崩溃并在控制台中显示错误: warning: could not execute support c
Bellow 是我的 didFinishPickingMediaWithInfo 方法,我知道我有很多不必要的代码,保留,发布等......但这是我可以让它工作的方式,我害怕在尝试时破坏它优化它。 谁
我有一个 UITableViewCell 按钮可以拍摄图像并将其放回单元格中。当我调用 UIImagePickerController 并拍摄图像时,它不会调用以下委托(delegate): func
我在使用 UIImagePickerController 时遇到问题。基本上,虽然选择器显示良好,但 UIImagePickerController didFinishPickingMediaWith
我有一个 View Controller ,它需要能够从相册和相机中选择图片。对于 didFinishPickingMediaWithInfo 我只能有 1 个委托(delegate)方法,虽然我可以
我有一个项目,其中有许多使用 imagePicker 的 View Controller 。每次,我都必须再次复制 didFinishPickingMediaWithInfo 并且只更改一些代码。 然
我有带有cameraOverlyView的UIImagePickerController。我向覆盖 View 添加了点击手势识别器 - 当用户点击 View 时,应停止并保存录制: let media
在我的应用程序上拍摄照片后,我试图关闭预览。我只想按下快门按钮,然后弹回显示 UIImagePickerController 的 UIViewController,而不显示图像预览以及“重拍”和“使用
我有一个简单的应用程序,您可以从照片库中选择现有视频,也可以使用 UIImagePickerController 拍摄视频。 我添加了以下代码,当我用相机制作新视频时,如果将来需要,我可以将它保存在照
关闭。这个问题需要debugging details 。目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
这似乎是一个简单的问题,我已经看到类似问题的答案,但答案不起作用(至少不再起作用)。我在 viewDidAppear 中有以下代码: UIImagePickerController *imagePic
我不断收到未使用的变量警告。我正在尝试显示模态视图,用户在其中选择一张照片,我想在 UIImageView 中使用所选图像。 不确定这些信息是否足够,但非常感谢任何帮助。 - (IBAction) b
我有一个带有四个选项卡的 tabBar 应用程序。每个选项卡在每个选项卡 View 的 UINavigationBar 左侧都有一个相机按钮。单击相机按钮,进入相机模式,拍照,最后选择“使用照片”后,
我是一名优秀的程序员,十分优秀!