It looks like you're new here. If you want to get involved, click one of these buttons!
- (IBAction)getPhoto:(id)sender {
if ([imagePickerPopover isPopoverVisible]) {
[imagePickerPopover dismissPopoverAnimated:YES];
//[imagePickerPopover release];
} else {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePickerPopover = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
if((UIButton *) sender == choosePhoto) {
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
CGRect choosePhotoRect;
if (self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
choosePhotoRect.origin = [sender frame].origin;
choosePhotoRect.size.width = 1;
choosePhotoRect.size.height = 1;
[imagePickerPopover presentPopoverFromRect:choosePhotoRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
} else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
choosePhotoRect.origin = [sender frame].origin;
choosePhotoRect.size.width = 1;
choosePhotoRect.size.height = 1;
[imagePickerPopover presentPopoverFromRect:choosePhotoRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}
} else {
CGRect takePhotoRect;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
if (self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
takePhotoRect.origin = [sender frame].origin;
takePhotoRect.size.width = 1;
takePhotoRect.size.height = 1;
[imagePickerPopover presentPopoverFromRect:takePhotoRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
} else if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft || self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
takePhotoRect.origin = [sender frame].origin;
takePhotoRect.size.width = 1;
takePhotoRect.size.height = 1;
[imagePickerPopover presentPopoverFromRect:takePhotoRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
}
}
}
}
Replies
SlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThanks for your help.
Regards
Toby...
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome