我是 iPhone 新手,现在正处于学习阶段。实际上我想实现读取存储在 iPhone PHOTO Gallery 中的图像,然后将其显示到我的应用程序上。
我在很多搜索引擎中进行了搜索,但找不到任何东西。你们这里都是专业人士。请指导我完成一些代码或教程。
多谢
Edit
另请查看此问题/答案以及用于从中获取图像的方法uiimagepickercontroller
因为我之前提到的方法已被弃用。
didFinishPickingMediaWithInfo 返回零照片 https://stackoverflow.com/questions/3088874/didfinishpickingmediawithinfo-return-nil-photo/4192109
查看文档http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html并查看此链接
http://iphone.zcentric.com/2008/08/28/using-a-uiimagepickercontroller/ http://iphone.zcentric.com/2008/08/28/using-a-uiimagepickercontroller/
它有大约相同的示例。
您可以使用这些方法来获取 UIImageView 对象中的图像
- (void)selectPhotos
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
[self presentViewController:picker animated:YES completion:nil];
//Deprecated In IOS6[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
imageView.image = image;
[[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)