swift引用oc类 在swift文件里如何给oc类的block赋值

swift引用oc类 在swift文件里如何给oc类的block赋值_第1张图片
有参数,无返回值

let controller =UIImagePickerController.init()

if index == 0 {

    controller.sourceType= .camera

} else {

    controller.sourceType= .photoLibrary

}

// default value is an array containing kUTTypeImage.文档说明默认值是此,故不需设置

// controller.mediaTypes = [kUTTypeImage]

controller.cropSize = CGSize(width: 300, height: 300)

controller.cropMode = .square//DZNPhotoEditorViewControllerCropModeSquare

controller.finalizationBlock = { [weak self] picker, info -> Void in

        QLDebug(picker)

        QLDebug(info)

        if let strongSelf = self {

           var image :UIImage? = nil

            if strongSelf.needEdit {

                 image = info?[UIImagePickerControllerEditedImage] as? UIImage

            } else {

                 image = info?[UIImagePickerControllerOriginalImage]as?UIImage

            }

            image = image?.fixOrientation()

            if let myImage = image {

               // 拿到image保存起来

               strongSelf.addImageButton.setBackgroundImage(myImage, for: .normal)

               strongSelf.setTupleOfSomeone(number:8, value: image)

               QLDebug(myImage)

               strongSelf.dismiss(animated: true, completion: nil)

            }

        }

}

controller.cancellationBlock = { [weak self] picker in

       QLDebug(picker?.viewControllers)

       if let strongSelf = self {

           if picker?.viewControllers.count == 1 {

                strongSelf.dismiss(animated: true, completion: nil)

           } else {

                picker?.popViewController(animated: true)

           }

       }

}      

       //UIApplication.shared.statusBarStyle = .default

       self.statusBarColor=KFXStatusBarColor.black

       self.present(controller, animated: true, completion: nil)

}

你可能感兴趣的:(swift引用oc类 在swift文件里如何给oc类的block赋值)