- (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上一样。现在所有它都可以让你选择你已经选择的那个。
答案 0 :(得分:0)
UIActionSheet
有一个名为showFromBarButtonItem: animated:
的方法。如果您指定了一个条形按钮项,则操作表将显示在iPad上的弹出窗口中。