Latest 1.0.0
Homepage https://github.com/pontake-dev/PTDPickerViewController
License MIT
Platforms ios 9.0
Authors

Carthage compatible
Version
License
Platform

PTDPickerViewController can implement the screen composed of UIPickerView, Cancel, and Enter button with simple code.
PTDPickerViewControllerはピッカー画面とキャンセル、決定の2つのボタンを表示させる画面をシンプルなコードで実装できます。

sample image

Description

It has the following functions.

  • An array of Strings to display on the picker.
    ピッカーに表示させる文字列の配列を指定できます。

  • Can set display language of cancellation and decision button.
    キャンセルボタンと決定ボタンの表示文言を指定できます。

  • You can specify an index to check picker by default when displaying the screen.
    デフォルトでピッカーのアイテムを選択済みにするindexの指定ができます。

  • You can detect that you tapped the dialog button with a closure.
    ダイアログのボタンをタップした事をクロージャで取得できます。

  • Support portrait and landscape.
    ポートレート、ランドスケープの画面向きに対応しています。

Example Usages

//create picker view model
let pickerItems: [String] = ["one","two","three","fore"]
let initialSelectedIndex = 2
let cancelButtonTitleString = "cancel"
let doneButtonTitleString = "done"
let pickerViewModel = PTDPickerViewModel.init(items: pickerItems,
                                              currentSelectedIndex: initialSelectedIndex,
                                              cancelButtonTitleString: cancelButtonTitleString,
                                              doneButtonTitleString: doneButtonTitleString)

//show picker
PTDPickerViewController.create().show(viewModel: pickerViewModel) { (selectedIndex) in
    guard let selectedIndex = selectedIndex else {
        print("cancel button tapped")
        return
    }

    print("selected index (selectedIndex)")
}

Installation

CocoaPods

Add to Podfile:

pod 'PTDPickerViewController'

Carthage

Add to Cartfile:

github "pontake-dev/PTDPickerViewController"

License

MIT

Latest podspec

{
    "name": "PTDPickerViewController",
    "version": "1.0.0",
    "summary": "PTDPickerViewController can implement the screen composed of UIPickerView, Cancel, and Enter button with simple code.",
    "description": "PTDPickerViewController can implement the screen composed of UIPickerView, Cancel, and Enter button with simple code.nnExample Usagesnn```swiftn//create picker view modelnlet pickerItems: [String] = ["one","two","three","fore"]nlet initialSelectedIndex = 2nlet cancelButtonTitleString = "cancel"nlet doneButtonTitleString = "done"nlet pickerViewModel = PTDPickerViewModel.init(items: pickerItems,n                                              currentSelectedIndex: initialSelectedIndex,n                                              cancelButtonTitleString: cancelButtonTitleString,n                                              doneButtonTitleString: doneButtonTitleString)nn//show pickernPTDPickerViewController.create().show(viewModel: pickerViewModel) { (selectedIndex) inn    guard let selectedIndex = selectedIndex else {n        print("cancel button tapped")n        returnn    }nn    print("selected index (selectedIndex)")n}n```",
    "homepage": "https://github.com/pontake-dev/PTDPickerViewController",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "pontake-dev": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.0",
    "source": {
        "git": "https://github.com/pontake-dev/PTDPickerViewController.git",
        "tag": "1.0.0"
    },
    "source_files": "PTDPickerViewController/**/*.{swift}"
}

Pin It on Pinterest

Share This