DTStringPicker 0.0.5

DTStringPicker 0.0.5

Didats Triadi 维护。




  • 作者
  • Didats Triadi

DTStringPicker

GitHub release Swift 5.0 Version License Platform CocoaPods

一个具有搜索功能的现代字符串选择器。

截图

Screenshot

要求

  • 基本 SDK: iOS 12
  • 部署目标: iOS 10.0 或更高版本

安装

在您的 Podfile 中添加以下内容

pod ‘DTStringPicker’

无部分的使用

// specify the strings
let rows = ["Number 1", "Another option 2", "The third choice", "4th item", "Other option", "Anything option"]

// create configuration
var config = DTStringPickerConfig(color: UIColor.black, background: UIColor.white)
config.title = "Choose one option"
config.alignment = .right

DTStringPicker.show(with: config, rowItems: rows.map({ DTStringPickerModelItem(text: $0) }), done: { item in
	print("Item: \(item)")
}, cancel: {
	print("Cancel ===")
}, from: self)

使用章节和完整配置

// specify the strings
let rows: [DTStringPickerModelSection] = [
	DTStringPickerModelSection(
		title: "Header 1",
		items: [
			DTStringPickerModelItem(text: "Pilih satu dua"),
			DTStringPickerModelItem(text: "Ini nomor dua"),
			DTStringPickerModelItem(text: "Di sini nomor ketiga"),
		]),
	DTStringPickerModelSection(
		title: "Second Header",
		items: [
			DTStringPickerModelItem(text: "Pilih satu dua"),
			DTStringPickerModelItem(text: "Ini nomor dua"),
			DTStringPickerModelItem(text: "Di sini nomor ketiga"),
		]),
]

// custom ui
var config = DTStringPickerConfig(color: UIColor.black, background: UIColor.white)
config.title = "Choose one option"
config.alignment = .left
config.itemFont = UIFont.systemFont(ofSize: 17, weight: .regular)
config.color = UIColor.black
config.backgroundColor = UIColor.white
config.shadowColor = UIColor.black
config.titleFont = UIFont.systemFont(ofSize: 30, weight: .bold)
config.titleColor = UIColor.black
config.sectionBackground = UIColor.init(red: 240/255, green: 240/255, blue: 240/255, alpha: 1)
config.sectionFont = UIFont.systemFont(ofSize: 16, weight: .bold)
config.sectionColor = UIColor.black

DTStringPicker.show(with: config, rowSections: rows, done: { item in
	print("Item: \(item)")
}, cancel: {
	print("Cancel ===")
}, from: self)

作者

Didats Triadi
http://rimbunesia.com
http://didatstriadi.com

许可

版权所有(c)2019 Didats Triadi

以下条件允许,任何人可以免费获得本软件及其相关文档文件的副本(以下简称“软件”),可以无限制地处理该软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件的副本,并允许收到的软件主体进行此类操作,但须遵守以下条件

上述版权声明和本许可声明应包含在软件的任何副本或大部分副本中。

本软件按“原样”提供,不提供任何类型的保证,无论是明示的、暗示的,还是与特定目的和侵权无关的保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其他责任(包括但不限于合同行为、侵权行为或其他方式引起的行为)承担责任,这些索赔、损害或其他责任源于、产生于或与软件或其使用相关联。