簡體   English   中英

如何在我的應用程序中實現“選擇現有照片”,如默認的iPhone電話簿?

[英]how do I implement “Choose Existing Photo” in my app like in default iphone phonebook?

我想開發一個應用程序,其功能與iphone電話簿捕獲圖像和選擇iamge相同,

我該怎么做才能做到這一點

我為UIActionSheet制作了一個UIImageView和一個按鈕,

現在我想在我的應用程序中執行“拍照”和“選擇現有照片”選項

幫助我,我很感激

提前致謝 ....

嘿@Veer你需要使用UIImagePickerController

查看文檔http://developer.apple.com/library/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];
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM