how to distinguish between capture image and photo album Image
After capture Image its show Retake or UsePhoto, On UsePhoto i am saving image to photo library and set to imageView.
On Click Upload From album, selected image set to UIImageView
But for both case the delegate method will call. Image upload from photo library or Image capture from the camera roll.
Do not want to save image when selected photo library.
and save image when select the camera capture and "Use Photo".
imageview.image = image;
-(void)imageUploaded:(NSInteger)selectedIndex{
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if (selectedIndex == 0){
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self.navigationController presentViewController:picker animated:YES completion:nil];
}
else if (selectedIndex == 1){
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:nil];
}
else if (selectedIndex == 2) {
NSLog(@"Zero Index ");
}
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo{
if(image != nil){
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
imageview.image = image;
}
[picker dismissViewControllerAnimated:YES completion:Nil];
}
You could use
picker.sourceType
to detect if the image was taken using the camera or if it was selected from camera roll.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.