- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个带有四个选项卡的 tabBar 应用程序。每个选项卡在每个选项卡 View 的 UINavigationBar
左侧都有一个相机按钮。单击相机按钮,进入相机模式,拍照,最后选择“使用照片”后,图片应传输到不同的 ViewController 并放置在 UIImageView
中,该方法仅在方法后显示名为 attachButtonInvoked
的事件被触发。这是我的方法,请忽略注释行:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//UIImage * image = [info objectForKey:UIImagePickerControllerEditedImage];
//[picker dismissViewControllerAnimated:NO completion:nil];
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
//UIImageWriteToSavedPhotosAlbum(image,nil,nil,nil);
RGPostTableViewController *postTableView = [self.storyboard instantiateViewControllerWithIdentifier:@"postTableView"];
RGPostViewController *postView = [self.storyboard instantiateViewControllerWithIdentifier:@"postView"];
UINavigationController *postControl = [self.storyboard instantiateViewControllerWithIdentifier:@"postControl"];
//postView.postImageView.image = image;
//[picker dismissViewControllerAnimated:NO completion:nil];
[picker presentViewController:postControl animated:YES completion:nil];
NSLog(@"%@", image);
[postTableView attachButtonInvoked];
postView.postImageView.image = image;
}
到目前为止,我正在获取图像。但是我无法成功调用attachButtonInvoked
;它不会显示 UIImageView 和设置图片。
最佳答案
看起来你可能在这里实例化了新的 View Controller
RGPostTableViewController *postTableView = [self.storyboard instantiateViewControllerWithIdentifier:@"postTableView"];
RGPostViewController *postView = [self.storyboard instantiateViewControllerWithIdentifier:@"postView"];
UINavigationController *postControl = [self.storyboard instantiateViewControllerWithIdentifier:@"postControl"];
而不是使用已经创建的。相反,尝试获取对那些已经实例化的 View Controller 的引用,以便您可以在 ImageView 上设置图像。
关于ios - 无法从 didFinishPickingMediaWithInfo 进行显式方法调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25028121/
我在我的应用程序中使用 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 左侧都有一个相机按钮。单击相机按钮,进入相机模式,拍照,最后选择“使用照片”后,
我是一名优秀的程序员,十分优秀!