我尝试使用以下代码在 UIPopoverController 上调整 UIImagePickerController 的大小:
UIImagePickerController *imagePicker =[[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType =
UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [NSArray arrayWithObjects:
(NSString *) kUTTypeImage,
nil];
imagePicker.allowsEditing = YES;
UIViewController *containerController = [[UIViewController alloc] init];
containerController.contentSizeForViewInPopover = CGSizeMake(360,200);
[containerController.view addSubview:imagePicker.view];
self.popoverController = [[UIPopoverController alloc]
initWithContentViewController:imagePicker];
self.popoverController.delegate = self;
[self.popoverController setPopoverBackgroundViewClass:[PopoverBackgroundView class]];
[self.popoverController presentPopoverFromRect:CGRectMake(512,510,10,10) inView:mC.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:FALSE];
}
imagePicker 完全按照我的意愿填充,但是当我触摸 popover 内的 imagePicker 的单元格时,它突然熄灭或变空。