All Projects → TMTBO → TTADataPickerView

TMTBO / TTADataPickerView

Licence: MIT license
A Swift picker view allow you to pick the titles you want and the date, time or dateTime in one view

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to TTADataPickerView

Mdatepickerview
Quick and easy date picker.
Stars: ✭ 373 (+965.71%)
Mutual labels:  picker, pickerview
RPicker
Simple and Easy-to-Use iOS Swift Date and Options Picker
Stars: ✭ 130 (+271.43%)
Mutual labels:  picker, pickerview
XPopupExt
XPopup扩展功能库,基于XPopup强大的弹窗能力和PickerView的选择器逻辑,封装了时间选择器弹窗、城市选择器弹窗和条件选择器。
Stars: ✭ 248 (+608.57%)
Mutual labels:  picker, pickerview
PSCityPickerView
城市选择器,可以选择国内所有的城市和地区
Stars: ✭ 47 (+34.29%)
Mutual labels:  picker, pickerview
SPPickerView
这是一个选择器,功能类似系统的UIPickerView,但是比UIPickerView的适用范围广得多
Stars: ✭ 28 (-20%)
Mutual labels:  picker, pickerview
Alerts And Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
Stars: ✭ 5,267 (+14948.57%)
Mutual labels:  picker, pickerview
Pickerview
One very very user-friendly Picker library(内部提供两种常用类型的Picker:时间选择器(支持聚合)和联动选择器(支持不联动)。支持扩展自定义Picker。支持自定义弹窗。支持作为view的非弹窗场景。)
Stars: ✭ 516 (+1374.29%)
Mutual labels:  picker, pickerview
Android Dial Picker
A custom rotating dial like picker for android
Stars: ✭ 56 (+60%)
Mutual labels:  picker, pickerview
Wheelpicker
A smooth, highly customizable wheel view and picker view, support 3D effects like iOS. 一个顺滑的、高度自定义的滚轮控件和选择器,支持类似 iOS 的 3D 效果
Stars: ✭ 684 (+1854.29%)
Mutual labels:  picker, pickerview
Agcircularpicker
AGCircularPicker is helpful component for creating a controller aimed to manage any calculated parameter
Stars: ✭ 592 (+1591.43%)
Mutual labels:  picker, pickerview
Swifthuecolorpicker
iOS HUE color picker
Stars: ✭ 44 (+25.71%)
Mutual labels:  picker, pickerview
Brpickerview
BRPickerView 封装的是iOS中常用的选择器组件,主要包括:日期选择器(支持年月日、年月等15种日期样式选择,支持设置星期、至今等)、地址选择器(支持省市区、省市、省三种地区选择)、自定义字符串选择器(支持单列、多列、二级联动、三级联动选择)。支持自定义主题样式,适配深色模式,支持将选择器组件添加到指定容器视图。
Stars: ✭ 2,149 (+6040%)
Mutual labels:  picker, pickerview
my-picker
高仿IOS的PickerView的JavaScript插件,3D形式的滚轮选择器,同时支持最多三级联动的选择效果,支持pc端和移动端两种平台浏览器。
Stars: ✭ 48 (+37.14%)
Mutual labels:  picker
EVContactsPicker
Contacts Picker for iOS 9+ that uses the newer Contacts API
Stars: ✭ 52 (+48.57%)
Mutual labels:  picker
Chocobo-Date-Range-Picker
🗓️ Component - The Date Range Picker easier to use in AngularJS.
Stars: ✭ 23 (-34.29%)
Mutual labels:  picker
ng-data-picker
🏄🏼 A data picker based on Angular 4+ (like native datetime picker of iOS)
Stars: ✭ 24 (-31.43%)
Mutual labels:  picker
PhoneCountryCodePicker
An iOS tableview picker for PhoneCountryCode (English & Chinese supported)
Stars: ✭ 31 (-11.43%)
Mutual labels:  picker
csc picker
A flutter package to display a country, states, and cities. In addition it gives the possibility to select a list of countries, States and Cities depends on Selected, also you can search country, state, and city all around the world.
Stars: ✭ 25 (-28.57%)
Mutual labels:  picker
ngx-mat-timepicker
A true material timepicker
Stars: ✭ 45 (+28.57%)
Mutual labels:  picker
react-calendar-datetime-picker
A simple and fast date and time picker component for React
Stars: ✭ 58 (+65.71%)
Mutual labels:  picker

TTADataPickerView

license MIT CocoaPods CocoaPods Build Status codecov

A Swift picker view allows you to pick the titles you want and the date, time or dateTime in one view

ScreenShort & gif

TTADataPickerView

Installation

TTADataPickerView is avaibale on CocoaPods.

  • 1 Insatll with CocoaPods:

     target 'MyApp' do
     	pod 'TTADataPickerView'
     end
    

    Then run a pod install inside you terminal

  • 2 Manually

    Clone the code from the github:

    git clone https://github.com/TMTBO/TTADataPickerView.git

    Then drop the TTADataPickerView folder to your project

    import TTADataPickerView

Features

  • 1 Pick Data and date in one PickerView:

    You do not need to write UIDatePicker and UIPickerView

  • 2 Configurable apperance:

    You can configure the PickerView's apperance as you want

Usage

  • 1 Initializer, you can configure the type and title

     let pickerView = TTADataPickerView(title: "TTADataPickerView", type: .text)
    
  • 2 Configure pickerView type with this property

     pickerView.type = .text
    

    Some Other type

     /// The component type of the TTADataPickerView
     public enum TTADataPickerViewType {
     	/// pickerView default
     	case text
     	/// datePicker
     	case date
     	/// date and time
     	case dateTime
         /// time
     	case time
     }
    
  • 3 Configure the delegate

     // You need to confirm `TTADataPickerViewDelegate`
     pickerView.delegate = self
    
  • 4 When the pickerView type is .text, configure this property to tell the pickerView what you want to select

     pickerView.textItemsForComponent = [["First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth"], ["First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth"], ["First", "Second", "Third", "Fourth", "Fifth", "Sixth", "Seventh", "Eighth", "Ninth", "Tenth"]]
    
  • 5 Show the PickerView

     pickerView.show()
     
     or
     
     pickerView.show { 
        // something you want to do after show the pickerView
    }
    
  • 6 Set the selectedTitles or selectedDate when the pickerView appers

     pickerView.selectedTitles(titles)
     pickerView.selectedDate(date)
    
  • 7 Configure the TTADataPickerView's apperance

     // config the TTADataPickerView's apperance
     let apperance = TTADataPickerView.appearance()
     apperance.setConfirmButtonAttributes(att: [NSForegroundColorAttributeName: UIColor.red])
     pperance.setCancelButtonAttributes(att: [NSForegroundColorAttributeName: UIColor.blue])
     apperance.setToolBarTintColor(color: .yellow)      apperance.setToolBarBarTintColor(color: .orange)
     apperance.setTitleFont(font: UIFont.systemFont(ofSize: 20))
     apperance.setTitleColor(color: .cyan)
    
  • 8 Delegate Functions

     // MARK: - TTADataPickerViewDelegate
     
     extension ViewController: TTADataPickerViewDelegate {
         // when the pickerView type is `.text`, you clicked the done button, you will get the titles you selected just now from the `titles` parameter
         func dataPickerView(_ pickerView: TTADataPickerView, didSelectTitles titles: [String]) {
             showLabel.text = titles.joined(separator: " ")
         }
         // when the pickerView type is NOT `.text`, you clicked the done button, you will get the date you selected just now from the `date` parameters
         func dataPickerView(_ pickerView: TTADataPickerView, didSelectDate date: Date) {
             // actually you need configure the dateFormatter dateStyle and timeStyle to get the currect date from the `date` parameter
             if pickerView.type == .date {
                 dateFormatter.dateStyle = .medium
             } else if pickerView.type == .time {
                 dateFormatter.timeStyle = .medium
             } else if pickerView.type == .dateTime {
                 dateFormatter.dateStyle = .medium
                 dateFormatter.timeStyle = .medium
             }
             showLabel.text = dateFormatter.string(from: date)
         }
         // when the pickerView  has been changed, this function will be called, and you will get the row and component which changed just now
         func dataPickerView(_ pickerView: TTADataPickerView, didChange row: Int, inComponent component: Int) {
             print(#function)
         }
         // when you clicked the cancel button, this function will be called firstly
         func dataPickerViewWillCancel(_ pickerView: TTADataPickerView) {
             print(#function)
         }
         // when you clicked the cancel button, this function will be called at the last
         func dataPickerViewDidCancel(_ pickerView: TTADataPickerView) {
             print(#function)
         }
     }
    
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].