iPhone - UIImagePickerControllerDelegate inheritance

南笙酒味 提交于 2019-11-27 07:35:56

As you noted, UIImagePickerController inherits from UINavigationController. It uses the same delegate property though and doesn't declare a (hypothetical) "imagePickerDelegate" of its own, so your delegate has to conform to both protocols. It makes sense, because you're also assigning the same delegate to the UINavigationController part (that knows nothing about the image picker).

The API design is a bit questionable here in my opinion, but anyway, all methods in UINavigationControllerDelegate are optional, so it suffices to declare that you conform to the protocol and be done with it.

Add these code like below,you can see the warning disappear.

@interface viewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate> { }
@end

The Protocol of UIImagePickerController and UINavigationController must be added in your interface, this can make the warning invisible.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!