iOS 颜色拾取器 颜色选择器 UIColorPickerVi

2022-05-10  本文已影响0人  woo_5857

//颜色拾取器

extension GNPenColorAndSizeView: UIColorPickerViewControllerDelegate {

    //文字颜色

      func customColorCick() {

            let colorPicker = UIColorPickerViewController.init()

          let config =  self.confgModel

          let color = UIColor.init(hex: config?.colorStr ?? "#000000").withAlphaComponent(config?.alpha ?? 1)

            colorPicker.selectedColor = color

            colorPicker.delegate = self;

            self.currentVC?.present(colorPicker, animated: true, completion: {

            });

        }

        //颜色拾取器

        func colorPickerViewControllerDidSelectColor(_ viewController: UIColorPickerViewController) {

            let sColor = viewController.selectedColor;

            let hex = sColor.hexString

            confgModel?.colorStr = hex

            confgModel?.alpha = sColor.alpha

            callBlock?()

            collectionView?.reloadData()

        }

        func colorPickerViewControllerDidFinish(_ viewController: UIColorPickerViewController) {

        }

}

上一篇下一篇

猜你喜欢

热点阅读