【发布时间】:2016-07-22 21:42:39
【问题描述】:
在使用访问 UIImagePickerControllerSourceTypePhotoLibrary 按钮覆盖时遇到问题是我得到的,问题出在选择器 (takeLib:) 中。
使用 imagePicker 的属性
@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:'
【问题讨论】:
标签: objective-c uibutton uiimagepickercontroller overlay photolibrary