0

J'ai du mal à utiliser l'accès à la superposition de boutons UIImagePickerControllerSourceTypePhotoLibrary, voici ce que j'ai, le problème est dans le sélecteur (takeLib :).Pas de @interface visible pour 'CameraTakePictureOverlay' pour UIImagePickerControllerSourceTypePhotoLibrary

en utilisant la propriété pour la 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; 
} 

le sélecteur est ici où le problème se produit

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

erreur a déclaré: No visible @interface for 'CameraTakePictureOverlay' declares the selector 'presentViewController:animated:completion:'

Répondre

0

De ce super-classe avez-vous héritez CameraTakePictureOverlay? La classe super doit être UIViewController. UIImagePickerController docs

Présentez l'interface utilisateur. Sur iPhone ou iPod touch, effectuez cette opération de manière modale (en mode plein écran) en appelant la méthode presentViewController: animation: completion: du contrôleur de vue actif, en passant votre contrôleur de sélecteur d'image configuré en tant que nouveau contrôleur de vue.

+0

La Super Classe est UIView –

+0

Ok, et c'est le problème. 'UIView' n'a pas la méthode' presentViewController'. –

+0

Essayez de déplacer le code 'takeLib' vers votre contrôleur de vue, et tout fonctionnera. –