【发布时间】:2011-06-11 07:17:52
【问题描述】:
我已将UIImagePickerController 添加到UIViewController。我还将UIImagePickerControllerDelegate 分配给了UIViewController。
当我执行以下行时,
myPicker.delegate = self;
Xcode 给我以下信息:
警告:分配给 ID 从不兼容的类型'RootViewController'
然后我将UINavigationControllerDelegate 协议添加到相同的UIViewController 并且错误消息消失了。
那么,当我添加UIImagePickerController 时,我是否必须将这两个协议都添加到UIViewController?
如果UIImagePickerController 是文档中所述的UINavigationController 的子类,这不应该是自动的吗?为什么我必须添加其父级的委托协议而不仅仅是UIImagePickerControllerDelegate 协议?
这是一个错误还是我遗漏了什么?
【问题讨论】:
标签: iphone inheritance uinavigationcontroller delegates uiimagepickercontroller