Last active
August 29, 2015 14:14
-
-
Save goshmx/bcf4a4125c01cb6f04e8 to your computer and use it in GitHub Desktop.
Funciones para trabajar con la libreria de la camara
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alert = [[UIAlertView alloc] initWithTitle:@"Fotografia" | |
message:@"Que desea hacer?" | |
delegate:self | |
cancelButtonTitle:@"Cancelar" | |
otherButtonTitles:@"Camara", @"Carrete", nil]; | |
[alert show]; | |
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex | |
{ | |
if(buttonIndex == 0) | |
{ | |
NSLog(@"Cancelar"); | |
} | |
else if(buttonIndex == 1) | |
{ | |
NSLog(@"Camara"); | |
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; | |
picker.delegate = self; | |
picker.allowsEditing = YES; | |
picker.sourceType = UIImagePickerControllerSourceTypeCamera; | |
[self presentViewController:picker animated:YES completion:NULL]; | |
} | |
else if(buttonIndex == 2) | |
{ | |
NSLog(@"Carrete"); | |
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; | |
picker.delegate = self; | |
picker.allowsEditing = YES; | |
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; | |
[self presentViewController:picker animated:YES completion:NULL]; | |
} | |
} | |
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { | |
UIImage *chosenImage = info[UIImagePickerControllerEditedImage]; | |
self.inputFoto.image = chosenImage; | |
[picker dismissViewControllerAnimated:YES completion:NULL]; | |
} | |
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker { | |
[picker dismissViewControllerAnimated:YES completion:NULL]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment