0

Having trouble using accessing the UIImagePickerControllerSourceTypePhotoLibrary button overlay here is what I got, the problem is in the selector (takeLib:).

using property for the 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;
}

the selector here is where the problem occurs

-(void) takeLib:(id)sender
{
self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.imagePicker.delegate = self;
[self presentViewController:self.imagePicker animated:YES completion:^{
  }];
}

error stated: No visible @interface for 'CameraTakePictureOverlay' declares the selector 'presentViewController:animated:completion:'

Un3qual
  • 1,332
  • 15
  • 27

1 Answers1

0

From what super class did you inherit CameraTakePictureOverlay?
Super class should be UIViewController. UIImagePickerController docs

Present the user interface. On iPhone or iPod touch, do this modally (full-screen) by calling the presentViewController:animated:completion: method of the currently active view controller, passing your configured image picker controller as the new view controller.

Evgeny Karkan
  • 8,782
  • 2
  • 32
  • 38