所以我有一个 UIPopoverController
我的房子是什么 UINavigationController
我有我的地方 UITableViewController
然而我的选择之一 UITableView
是去选择一个图像 UIImagePickerController
...现在在iPhone上,我可以简单地使用 presentModalViewController:animated:
但是从UIPopoverController中调用它会导致崩溃,因此不可能......
我也知道 UIImagePickerController
需要自己的 UINavigationController
所以我不能只是推 pushViewController:animated:
要么...
所以我想出如果我保持链接到 UIPopoverController
我创建,然后我可以使用 setContentViewController:animated:
切换到UIImagePickerController的viewController ...
但是,我现在停留在为用户提供回到之前的方法 UINavigationController
因为我需要能够添加一个取消按钮 UIImagePickerController
但是当我尝试这样做时,取消按钮将不会被添加...
继承我正在使用的代码
-(void)doPhotoalbums {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]) {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
[imagePicker setDelegate:self];
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[imagePicker setContentSizeForViewInPopover:CGSizeMake(320, 480)];
UIBarButtonItem *cancel = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:nil];
[imagePicker.navigationItem setLeftBarButtonItem:cancel];
//[self presentModalViewController:imagePicker animated:YES];
[[self parentPopoverController] setContentViewController:imagePicker animated:YES];
} else {
[UIAlertView showMessage:@"This device does not have any photo albums."];
}
}
所以我的问题是..有谁知道如何解决这个问题?通过添加取消/返回按钮,我可以挂钩,以使导航控制器切换回来或另一种方式来呈现这一点(我想避免在两个UIPopoverControllers之间切换,但我不知道我还能做什么..
谢谢
利亚姆