당신이 아이 패드에 UIImagePickerControllerSourceTypePhotoLibrary에 선택기를 설정하면, 당신은 popoverview에서이를 제시해야합니다 (!) 그렇지 않으면 예외가 발생합니다. 이어야가 팝 오버의 크기를 제어에 나는 (표준 크기는 내 의견으로는 너무 작), 이런 식으로 작업을 수행합니다
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
if(imagePicker!=nil && rightPane.frame.size.width>0)
[imagePicker.view setFrame:imagePicker.view.superview.frame];
}
:
-(void)openPhotoPicker
{
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.navigationBar.opaque = true;
//put the image picker in its own container controller, to control its size
UIViewController *containerController = [[UIViewController alloc] init];
containerController.contentSizeForViewInPopover = rightPane.frame.size;
[containerController.view addSubview:imagePicker.view];
//then, put the container controller in the popover
popover = [[UIPopoverController alloc] initWithContentViewController:containerController];
//Actually, I would like to do the following, but iOS doesn't let me:
//[rightPane addSubview:imagePicker.view];
//So, put the popover over my rightPane. You might want to change the parameters to suit your needs.
[popover presentPopoverFromRect:CGRectMake(0.0, 0.0, 10.0,0.0)
inView:rightPane
permittedArrowDirections:UIPopoverArrowDirectionLeft
animated:YES];
//There seems to be some nasty bug because of the added layer (the container controller), so you need to call this now and each time the view rotates (see below)
[imagePicker.view setFrame:containerController.view.frame];
}
내가 또한 다음을, 회전 버그에 대응하기 위해
완벽하지는 않지만 지금은 테스트 목적으로는 괜찮습니다. 내가 Popoverview를 사용하도록 강요받는 것을 좋아하지 않기 때문에 나는 내 자신의 Imagepicker를 쓰는 것을 고려한다 ... 그러나 잘, 그것은 다른 이야기이다.
분명히 누군가가 iPad와 함께 UIImagePickerControllerSourceTypePhotoLibrary를 사용 했습니까? – wasabi