ColorPickTip 0.4.0

ColorPickTip 0.4.0

Yuki Yamashita维护。



  • akeome

ColorPickTip

CI Status Version License Platform

概述

  • 适用于iOS的简单颜色选择器。
  • 在闭包中检测选择的颜色。
  • 使用UIColor可定制调色板。

示例

oct-30-2018 21-16-30 oct-30-2018 21-18-10

要求

  • Xcode10
  • Swift 4.2
  • iOS 9.3或更高版本

安装

ColorPickTip可通过CocoaPods获取。要安装它,只需将以下行添加到Podfile中

pod 'ColorPickTip'

使用方法

ColorPickTip基于UIPopoverPresentationController。要显示它,请使用present(_:animated:completion:)方法。

let paletteColors: [[UIColor?]] = [[.red, .green, .blue], [.white, nil, .black]]

let colorPickTipVC = ColorPickTipController(palette: paletteColors, options: nil)
colorPickTipVC.popoverPresentationController?.delegate = colorPickTipVC
colorPickTipVC.popoverPresentationController?.sourceView = sender  // some UIButton
colorPickTipVC.popoverPresentationController?.sourceRect = sender.bounds
        
self.present(colorPickTipVC, animated: true, completion: nil)

选项

有一些选项。

/// Theme color of PopupView. Default is light.
public var popoverViewTheme: PopoverViewTheme

/// Style for color palette. Default is round.
public var paletteStyle: PaletteStyle

/// Dismiss popover after picked. Default is true.
public var isDismissOnPick: Bool

/// ViewSize. Default is width:240 / height:150.
public var viewSize: CGSize

作者

Yuki Yamashita@akeome Twitter

许可证

ColorPickTip在MIT许可证下可用。有关更多信息,请参阅LICENSE文件。