对于UIImagePickerControllerSourceTypePhotoLibrary没有可见的@interface for'CameraTakePictureOverlay'
问题描述:
无法使用访问UIImagePickerControllerSourceTypePhotoLibrary按钮覆盖这里是我得到的问题是在选择器(takeLib :)中。使用属性为imagePicker对于UIImagePickerControllerSourceTypePhotoLibrary没有可见的@interface for'CameraTakePictureOverlay'
@property (weak, nonatomic) UIImagePickerController *imagePicker;
- (UIButton *) createGetLibraryButton {
UIImage *imglibraryPicture = [StyleKit imageOfLibraryIcon];
CGRect bounds = [UIScreen mainScreen].bounds;
CGRect takePicRect = CGRectMake((bounds.size.width/2) - (imglibraryPicture.size.width/1),
bounds.size.height-imglibraryPicture.size.height/2-CAMERA_BOTTOM_BUTTON_PADDING,
imglibraryPicture.size.width/2,
imglibraryPicture.size.height/2);
UIButton *btnLibrary = [[UIButton alloc] initWithFrame:takePicRect];
//using selector(takeLib:)
[btnLibrary setBackgroundImage:imglibraryPicture forState:UIControlStateNormal];
[btnLibrary addTarget:self action:@selector (takeLib:) forControlEvents:UIControlEventTouchUpInside];
return btnLibrary;
}
这里的选择是哪里出现问题
-(void) takeLib:(id)sender
{
self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.imagePicker.delegate = self;
[self presentViewController:self.imagePicker animated:YES completion:^{
}];
}
错误陈述
: No visible @interface for 'CameraTakePictureOverlay' declares the selector 'presentViewController:animated:completion:'
答
从什么超阶级你继承CameraTakePictureOverlay
?
超级班应该是UIViewController
。 UIImagePickerController文档
提供用户界面。在iPhone或iPod touch上,通过调用当前活动视图控制器的presentViewController:animated:completion:方法,以模式(全屏)方式执行此操作,将已配置的图像选取器控制器作为新视图控制器传递。
超级类是UIView –
好吧,那就是问题所在。 'UIView'没有'presentViewController'方法。 –
尝试将'takeLib'代码移动到您的视图控制器,并且一切都将工作。 –