Assigning to id<UINavigationControllerDelegate,UIImagePickerControllerDelegate> from incompatible type CameraViewController* warning shows near picker.delegate = self; line
-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if((UIButton *) sender == takePhoto) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
//picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
[self presentModalViewController:picker animated:YES];
}
Note that you must conform to both the UIImagePickerControllerDelegate and UINavigationControllerDelegate protocols to use the image picker.
Just add both protocols.
@interface MyViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
Then set the delegate obviously. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With