【发布时间】:2013-01-22 21:25:16
【问题描述】:
如何在代码中创建图像选择器?
我在 ipad 上使用 iOS 6.0 和 ARC。
我希望能够选择图片并以某种方式获取所选图片的 UIImage。
我确实添加了代表: 在这里输入代码
在 viewDidLoad 方法中做了
enter code hereimagePicker = [[UIImagePickerController alloc] init];
在按钮方法中我已经放了
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagePicker animated:YES];
崩溃发生在
[self presentModalViewController:imagePicker animated:YES];
【问题讨论】:
-
我已经更新了这个问题来解释更多。
-
如果您从图库中选择照片,则无法在 iPad 上以模态方式呈现此内容。您需要在 UIPopoverController 中显示选择器。
-
实际上,您的代码对我有用。您的问题可能出在其他地方。
-
@user1157605 你在 iPhone 上测试过,不是吗。
-
@0x7fffffff 啊,是的,直到现在才看到。
标签: ios objective-c ipad uiimage