Guest User

Untitled

a guest
Apr 23rd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Using initWithTitle... and adding buttons afterwards puts the cancel button on top,
  2.     // which isn't where it seems like it should be. Gotta keep track of how many buttons we're
  3.     // adding so we can set the index later
  4.     NSInteger cancelIndex = 0;
  5.     if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
  6.         [imageSourceSheet addButtonWithTitle:NSLocalizedString(@"Take Photo", @"Take Photo Button")];
  7.         cancelIndex++;
  8.     }
  9.    
  10.    
  11.     if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
  12.         [imageSourceSheet addButtonWithTitle:NSLocalizedString(@"Photo Library", @"Photo Library Button")];
  13.         [imageSourceSheet addButtonWithTitle:NSLocalizedString(@"Last Photo Taken", @"Last Photo Taken Button")];
  14.         cancelIndex+=2;
  15.     }
  16.     [imageSourceSheet addButtonWithTitle:@"Cancel"];
  17.     [imageSourceSheet setCancelButtonIndex:cancelIndex];
  18.    
  19.     [imageSourceSheet showInView:self.tableView];
Add Comment
Please, Sign In to add comment