如何解决:“无法将类型为'SelfieListViewController'的值分配为类型为'(UIImagePickerControllerDelegate&UINavigationControllerDelegate)吗?'”

时间:2018-12-22 15:15:09

标签: swift

我收到此错误: 无法将类型'SelfieListViewController'的值分配为类型'(UIImagePickerControllerDelegate&UINavigationControllerDelegate)?'

此功能:

@objc func createNewSelfie()
    {
        //Create a new image picker
        let imagePicker = UIImagePickerController()

        //If a camera is a available, use it; otherwise, use the photo library
        if UIImagePickerController.isSourceTypeAvailable(.camera)
        {
            imagePicker.sourceType = .camera

            //If the front-facing camera is available, use that
            if UIImagePickerController.isCameraDeviceAvailable(.front)
            {
                imagePicker.cameraDevice = .front
            }
        }
        else
        {
            imagePicker.sourceType = .photoLibrary
        }

        //We want this object to be notified when the user takes a photo
        imagePicker.delegate = self

        //Present the image picker
        self.present(imagePicker, animated: true, completion: nil)
    }

0 个答案:

没有答案