开发者

iphone how to go to the image gallery after taking photo through Xcode

Hi all I am implementing the following code to take a photo through my application开发者_C百科

[[[UIApplication sharedApplication] keyWindow] setRootViewController:picker];
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentModalViewController:picker animated:NO];

Can anyone tel me How I can go to the photo gallery after the user takes the photo and not return to the application.


i think you might want to try this

How to open camera while I click the UIButton in iPhone?

or i really didn't get the question

Edit: Well you can use the same code with UIImagePickerControllerSourcePhotoLibrary after taking the pic from camera. I mean call this Function with UIImagePickerControllerSourcePhotoLibrary then it will take you to photo Library and then back again to your application.


UIImagePickerControllerSourcePhotoLibrary


If you want to shoot a picure use this code -

UIImagePickerController* picker = [[UIImagePickerController alloc] init];
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.delegate = self;
    picker.allowsImageEditing = YES;
    [[self navigationController] presentModalViewController:picker animated:YES];

If you want to go to photo gallery and wants to select a photo from there use this code -

UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
picker.allowsImageEditing = YES;
[[self navigationController] presentModalViewController:picker animated:YES];

Notice the difference between the picker's sourceType

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜