美文网首页
iOS 颜色拾取器 颜色选择器 UIColorPickerVi

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

作者: woo_5857 | 来源:发表于2022-05-10 14:47 被阅读0次

    //颜色拾取器

    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 颜色拾取器 颜色选择器 UIColorPickerVi

          本文链接:https://www.haomeiwen.com/subject/kyidurtx.html