Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
  2.  
  3. UIImagePickerController *picker = [[UIImagePickerController alloc] init];
  4.  
  5. picker.delegate = self;
  6.  
  7. picker.allowsEditing = YES;
  8.  
  9. picker.sourceType = UIImagePickerControllerSourceTypeCamera;
  10.  
  11. [self presentViewController:picker animated:YES completion:NULL];
  12.  
  13. }
  14.  
  15. else{
  16.  
  17.  
  18. UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Camera Unavailable"
  19. message:@"Unable to find a camera on your device."
  20. delegate:nil
  21. cancelButtonTitle:@"OK"
  22. otherButtonTitles:nil, nil];
  23. [alert show];
  24.  
  25. alert = nil;
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement