开发者

how do I implement "Choose Existing Photo" in my app like in default iphone phonebook?

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 advan开发者_StackOverflow社区ce ....


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];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜