【发布时间】:2011-11-29 03:25:06
【问题描述】:
- (IBAction)openImagePicker:(id)sender //Makes UIImagePicker roll up from the bottom.
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
// We are using an iPhone
UIActionSheet *alertSheet = [[UIActionSheet alloc] initWithTitle:@"Where do you want to get your daily image?" delegate:(self) cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Camera", @"Library", nil];
[alertSheet setTag:0];
[alertSheet setDelegate:self];
[alertSheet showFromTabBar:[[self tabBarController] tabBar]];
[alertSheet release];
}
else
{
// We are using an iPad
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.delegate = self;
UIPopoverController *popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePickerController];
popoverController.delegate=self;
[popoverController presentPopoverFromRect:((UIButton *)sender).bounds inView:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
所以它在 iPad 部分的位置,我想要它做的是让你在拍摄一张新照片和使用你已有的照片之间做出选择,就像它在 iPhone 上一样。现在所有它都可以让你选择一个你已经拿过的。
【问题讨论】:
标签: objective-c ipad uibutton uiimagepickercontroller uipopovercontroller