Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Using initWithTitle... and adding buttons afterwards puts the cancel button on top,
- // which isn't where it seems like it should be. Gotta keep track of how many buttons we're
- // adding so we can set the index later
- NSInteger cancelIndex = 0;
- if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
- [imageSourceSheet addButtonWithTitle:NSLocalizedString(@"Take Photo", @"Take Photo Button")];
- cancelIndex++;
- }
- if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
- [imageSourceSheet addButtonWithTitle:NSLocalizedString(@"Photo Library", @"Photo Library Button")];
- [imageSourceSheet addButtonWithTitle:NSLocalizedString(@"Last Photo Taken", @"Last Photo Taken Button")];
- cancelIndex+=2;
- }
- [imageSourceSheet addButtonWithTitle:@"Cancel"];
- [imageSourceSheet setCancelButtonIndex:cancelIndex];
- [imageSourceSheet showInView:self.tableView];
Add Comment
Please, Sign In to add comment