All Projects → ChernyshenkoTaras → Tcpickerview

ChernyshenkoTaras / Tcpickerview

Licence: mit
Picker view popup with multiply rows selection written in Swift

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Tcpickerview

Vc Popup
一个行为标准的vue popup组件集
Stars: ✭ 289 (+244.05%)
Mutual labels:  picker, popup
XPopupExt
XPopup扩展功能库,基于XPopup强大的弹窗能力和PickerView的选择器逻辑,封装了时间选择器弹窗、城市选择器弹窗和条件选择器。
Stars: ✭ 248 (+195.24%)
Mutual labels:  popup, picker
Mkcolorpicker
ColorPicker is a fantastic color picker 🎨 written in Swift. Developers can use our color picker as is or they can customize it with all the available features
Stars: ✭ 59 (-29.76%)
Mutual labels:  picker
React Poppop
A mobile support and multi-directional modal for ReactJS
Stars: ✭ 78 (-7.14%)
Mutual labels:  popup
Circularpicker
CircularPicker is helpful for creating a controller aimed to manage any calculated parameter.
Stars: ✭ 73 (-13.1%)
Mutual labels:  picker
Picker
Picker - A CameraX based WhatsApp Style Image-Video Picker
Stars: ✭ 69 (-17.86%)
Mutual labels:  picker
Material Ui Color Picker
<ColorInput> component for material-ui
Stars: ✭ 74 (-11.9%)
Mutual labels:  picker
Datetimepicker
This is a custom android holo datepicker timepicker
Stars: ✭ 56 (-33.33%)
Mutual labels:  picker
Magnetic
SpriteKit Floating Bubble Picker (inspired by Apple Music) 🧲
Stars: ✭ 1,252 (+1390.48%)
Mutual labels:  picker
Datasource
Simplifies the setup of UITableView data sources using type-safe descriptors for cells and sections. Animated diffing built-in.
Stars: ✭ 72 (-14.29%)
Mutual labels:  uitableview
React Native Bubble Select
An easy-to-use customizable bubble animation picker, similar to the Apple Music genre selection
Stars: ✭ 78 (-7.14%)
Mutual labels:  picker
Colorpickerwpf
Simple color picker control for WPF
Stars: ✭ 71 (-15.48%)
Mutual labels:  picker
React Native Alert Pro
The Pro Version of React Native Alert (Android & iOS)
Stars: ✭ 69 (-17.86%)
Mutual labels:  popup
Tippyjs
Tooltip, popover, dropdown, and menu library
Stars: ✭ 9,433 (+11129.76%)
Mutual labels:  popup
Xui
A drop-in replacement for iOS Settings Bundle "Settings.bundle".
Stars: ✭ 60 (-28.57%)
Mutual labels:  uitableview
Alertjs
Dialog Builder allows you to create fully customisable dialogs and popups in Dynamics 365.
Stars: ✭ 80 (-4.76%)
Mutual labels:  popup
React Native Modal Dropdown
A react-native dropdown/picker/selector component for both Android & iOS.
Stars: ✭ 1,103 (+1213.1%)
Mutual labels:  picker
Fwpopupviewoc
信手拈来的OC弹窗库:1、继承 FWPopupBaseView 即可轻松实现各种位置、动画类型的弹窗;2、新功能引导弹窗。更多弹窗场景等你来挑战,总之,想怎么弹就怎么弹!!!
Stars: ✭ 70 (-16.67%)
Mutual labels:  popup
Jalert
jQuery alert/modal/lightbox plugin
Stars: ✭ 73 (-13.1%)
Mutual labels:  popup
Jbox
jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.
Stars: ✭ 1,251 (+1389.29%)
Mutual labels:  popup

Picker view popup with multiply/single rows selection written in Swift with colors/sizes/texts/and fonts customization

Requirements

TCPickerView works on iOS 9 and higher. It depends on the following Apple frameworks, which should already be included with most Xcode templates:

  • Foundation
  • UIKit

Installation

CocoaPods

You can use CocoaPods to install TCPickerView by adding it to your Podfile:

platform :ios, '9.0'
use_frameworks!
pod 'TCPickerView'

Manually

  1. Download and drop Classes and Assets folder in your project.
  2. Congratulations!

Example

import UIKit
import TCPickerView

class ViewController: UIViewController {

    @IBAction private func showButtonPressed(button: UIButton) {
        var picker: TCPickerViewInput = TCPickerView()
        picker.title = "Cars"
        let cars = [
            "Chevrolet Bolt EV",
            "Subaru WRX",
            "Porsche Panamera",
            "BMW 330e",
            "Chevrolet Volt",
            "Ford C-Max Hybrid",
            "Ford Focus"
        ]
        let values = cars.map { TCPickerView.Value(title: $0) }
        picker.values = values
        picker.delegate = self
        picker.selection = .single
        picker.completion = { (selectedIndexes) in
            for i in selectedIndexes {
                print(values[i].title)
            }
        }
        picker.closeAction = {
            print("Handle close action here")
        }
        picker.show()
    }
}

If you want to set pre-selected values: TCPickerView.Value(title: "Chevrolet Bolt EV", isChecked: true)

Picker supports multiply, single and none row selection. You can set desired behavior by setting selection property of TCPickerView to the appropriate value.

Tracking user actions

TCPickerViewOutput allows you track what item was selected. Implament this method in your controller and assign delegate property to this controller.

public protocol TCPickerViewOutput: class {
    func pickerView(_ pickerView: TCPickerView, didSelectRowAtIndex index: Int)
}

You can request new method if you need it. I'm open to discuss

UI customization

Create a class that conform to TCPickerViewThemeType protocol and adjust UI layout or use one of the existing themes:

  • TCPickerViewDefaultTheme
  • TCPickerViewLightTheme
  • TCPickerViewDarkTheme

Use them as reference for creation you own awesome design.

You can change next properties:

var doneText: String { get }
var closeText: String { get }

var backgroundColor: UIColor { get }
var titleColor: UIColor { get }
var doneTextColor: UIColor { get }
var closeTextColor: UIColor { get }
var headerBackgroundColor: UIColor { get }
var doneBackgroundColor: UIColor { get }
var closeBackgroundColor: UIColor { get }
var separatorColor: UIColor { get }

var buttonsFont: UIFont { get }
var titleFont: UIFont { get }

var rowHeight: CGFloat { get }
var headerHeight: CGFloat { get }
var cornerRadius: CGFloat { get }

var searchColor: UIColor { get }

Search

This library provides easy to use search box. You can enable it by using isSearchEnabled property and then subscribe to searchResult: TCPicker.SearchResult closure.

    picker.isSearchEnabled = true
    picker.searchResult = { [unowned self] searchText in
        self.filteredCars = cars.filter { $0.contains(searchText) }
        let values = filteredCars.map { TCPickerView.Value(title: $0) }
        picker.values = values
    }

Feel free to refer DarkViewController for the usage example. Or you can implement UISearchBarDelegate delegate methods in your controller and assign searchBar.delegate to it e.g. picker.searchBar.delegate = self

Use your own cells

  • desing your cell in .xib or code
  • conform your cell to TCPickerCellType protocol
  • register cell in picker by using one of next methods
    func register(_ nib: UINib?, forCellReuseIdentifier identifier: String)
    func register(_ cellClass: Swift.AnyClass?, forCellReuseIdentifier identifier: String)
  • implement TCPickerViewOutput protocol in your view controller
  • dequeue your cell in func pickerView(_ pickerView: TCPickerViewInput, cellForRowAt indexPath: IndexPath) -> (UITableViewCell & TCPickerCellType)? method by calling func dequeueReusableCell(withIdentifier identifier: String, for indexPath: IndexPath) -> UITableViewCell & TCPickerCellType
  • for more details have a look into LightViewController file in a example project.

Contributing to this project

If you have feature requests or bug reports, feel free to help out by sending pull requests or create issues.

License

This code is distributed under the terms and conditions of the MIT license.

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].