如何实现“选择现有照片”在我的应用程序中,就像在默认的 iPhone 电话簿中一样?

发布于 2024-10-20 09:57:17 字数 202 浏览 5 评论 0原文

我想开发一个与 iphone 电话簿捕获图像并选择 iamge 功能相同的应用程序,

我应该使用什么来做这样的事情

我已经制作了一个 UIImageView 和一个 UIActionSheet 按钮,

现在我想执行“拍照”和“选择”我的应用程序中的“现有照片”选项

帮助了我,我非常感谢,

提前致谢......

I want to develop an app which has functionality same as iphone phonebook capturing image and choosing iamge,

what should I to use for doing such

I have made an UIImageView and a button for UIActionSheet,

now I want to perform "Take Photo" and "Choose Existing Photo" options in my app

help me out, I do appreciate

thanks in advance ....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

零崎曲识 2024-10-27 09:57:17

嘿@Veer,你需要使用 UIImagePickerController

查看文档
http://developer.apple.com/库/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
并查看此链接

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 presentModalViewController:picker animated:YES];
    [picker release];
}

- (void)imagePickerController:(UIImagePickerController *)picker
        didFinishPickingImage:(UIImage *)image
                  editingInfo:(NSDictionary *)editingInfo
{
    imageView.image = image;
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];
}

Hey @Veer you need to use UIImagePickerController

check out the documentation
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIImagePickerController_Class/UIImagePickerController/UIImagePickerController.html
and check out this link

http://iphone.zcentric.com/2008/08/28/using-a-uiimagepickercontroller/

It has sample examples about the same.

Edit you can use these methods to get the image in you UIImageView object

- (void)selectPhotos
{
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    picker.delegate = self;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

- (void)imagePickerController:(UIImagePickerController *)picker
        didFinishPickingImage:(UIImage *)image
                  editingInfo:(NSDictionary *)editingInfo
{
    imageView.image = image;
    [[picker parentViewController] dismissModalViewControllerAnimated:YES];
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文