MKColorPicker 1.2

MKColorPicker 1.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布时间最近一次发布2018年4月
SPM支持SPM

MKSpinner维护。



  • 作者
  • Moayad Al kouz

MKColorPicker

CI Status Version License Platform

##MKColorPicker MKColorPicker是一个非常优秀的颜色选择器🎨用Swift编写。开发者可以将我们的颜色选择器直接使用,或者根据所有可用功能自定义它

示例

要运行示例项目,首先克隆仓库,然后在Example目录中运行pod install

截图

BubbleTransition

要求

iOS8+

安装

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

pod "MKColorPicker"

如何使用

import MKColorPicker

let MKColorPicker = MKColorPickerViewController()
MKColorPicker.selectedColor = { color in
    //Put your code that will be excuted when select a color
}

//To inialize the picker as popover controller
if let popoverController = MKColorPicker.popoverPresentationController{
    popoverController.delegate = MKColorPicker
    popoverController.permittedArrowDirections = .any
    popoverController.sourceView = sender
    popoverController.sourceRect = sender.bounds
}

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

自定义选择器

MKColorPicker.autoDismissAfterSelection = false //default: true

MKColorPicker.scrollDirection = .vertical //default: .horizontal

MKColorPicker.style = .square //default: .circle

MKColorPicker.pickerSize = CGSize(width: newWidth, height: newHeight) //default 250, 250


//Change default colors list "colorPalette.plist" contains array of hexa. colors, 
//you can simply change it to your colors or initialize your list from anywhere your want.
var colors = [UIColor]()
let path = Bundle.main.path(forResource: "colorPalette", ofType: "plist")
let pListArray = NSArray(contentsOfFile: path!)

if let colorPalettePlistFile = pListArray as? [String] {
    for col in colorPalettePlistFile{
        colors.append(UIColor(hex: col))
    }
}

MKColorPicker.allColors = colors

作者

Moayad Al kouz, [email protected]

许可证

MKColorPicker采用MIT许可证。有关更多信息,请参阅LICENSE文件。