Ipad UIImagePickerController和UIPopoverController错误 [英] Ipad UIImagePickerController and UIPopoverController error
问题描述
我使用此代码打开带有imagepicker的popover
I am using this code to open a popover with imagepicker
-(IBAction)photosAction:(id)sender
{
// dismiss any left over popovers here
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
self.popoverController = popover;
popoverController.delegate = self;
[popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
[picker release];
但这会导致错误成员'popoverController'的请求,而不是结构或联盟并且此错误'popoverController'未声明(首次在此函数中使用)。
But this results in this error request for member 'popoverController' in something not a structure or union and this error 'popoverController' undeclared (first use in this function).
此外我想解雇popover时选择了图像。
Also I want to dismiss the popover when the image is selected.
选择图像后,我应该在以下函数中添加什么代码来解除弹出窗口。
What code should I put in the following function to dismiss the popover once the image is selected.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
感谢您的帮助!
推荐答案
此错误是由于我的功能需要栏按钮项目,我使用的是普通的ui按钮。
This error was caused becaused my function requires a bar button item and i was using a normal ui button.
这篇关于Ipad UIImagePickerController和UIPopoverController错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!