【发布时间】:2015-02-19 03:09:01
【问题描述】:
我手动向UIViewController 添加了两个额外的控制器(UINavigationControllerDelegate 和UIImagePickerController),在添加UIImagePickerController 后收到错误消息,
Multiple inheritance from classes UIViewController and UIImagePickerController
我现在不确定如何解释和解决这个问题。
由于此错误,当我使用 image.delegate 方法并将其设置为等于 self 时,我也看到了一个错误
Type ViewController does not conform to protocol UIImagePickerControllerDelegate
代码:
class ViewController: UIViewController, UINavigationControllerDelegate, UIImagePickerController {
@IBAction func pickImage(sender: UIButton) {
var image = UIImagePickerController()
image.delegate = self
image.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
image.allowsEditing = false
self.presentViewController(image, animated: true, completion: nil)
}
【问题讨论】:
标签: ios swift uiviewcontroller