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

//颜色拾取器

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) {


        }

}

你可能感兴趣的:(iOS 颜色拾取器 颜色选择器 UIColorPickerViewController)