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

老子叫甜甜 提交于 2020-01-13 05:51:28

问题


Hi all I am implementing the following code to take a photo through my application

[[[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.


回答1:


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.




回答2:


UIImagePickerControllerSourcePhotoLibrary



回答3:


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



来源:https://stackoverflow.com/questions/5037640/iphone-how-to-go-to-the-image-gallery-after-taking-photo-through-xcode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!