gpt4 book ai didi

objective-c - 从不兼容类型 'id' 分配给 'CameraVIewController*' '

转载 作者:太空狗 更新时间:2023-10-30 03:11:18 24 4
gpt4 key购买 nike

Assigning to id<UINavigationControllerDelegate,UIImagePickerControllerDelegate> from incompatible type CameraViewController* picker.delegate = self; 附近显示警告行

-(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];

最佳答案

请注意,您必须同时遵守 UIImagePickerControllerDelegateUINavigationControllerDelegate 协议(protocol)才能使用图像选择器。

关于objective-c - 从不兼容类型 'id<UINavigationControllerDelegate,UIImagePickerControllerDelegate>' 分配给 'CameraVIewController*' ',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8571783/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com