Coder Social home page Coder Social logo

isandboy / usefulpickerview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jasnig/usefulpickerview

0.0 1.0 0.0 222 KB

可以简单快速实现点击TextField或者按钮弹出单列, 多列, 多列关联,城市选择, 日期选择的pickerView

License: MIT License

Swift 99.66% Ruby 0.34%

usefulpickerview's Introduction

#UsefulPickerView

##使用示例效果

TextField使用示例.gif

按钮使用示例.gif

可以简单快速灵活的实现上图中的效果


书写思路移步这里

Requirements

  • iOS 8.0+
  • Xcode 7.3 or above

Installation

CocoaPods

####1.在你的项目Podfile里面添加下面的内容

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0' use_frameworks!

pod 'UsefulPickerView', '~> 0.1.2'

###2.终端中执行命令 pod install ###3. 使用{Project}.xcworkspace打开项目


###或者直接下载,将下载文件的Scource文件夹下的文件拖进您的项目中就可以使用了

###Usage

###如果是使用cocoapods安装的需要在使用的文件中 ###import UsefulPickerView

####1. TextField 使用, 可以使用xib或者代码初始化 // 代码生成 let test = SelectionTextField(frame: CGRect(x: 20, y: 340, width: 340, height: 28)) test.borderStyle = .RoundedRect test.placeholder = "代码初始化" test.showSingleColPicker("测试代码", data: singleData, defaultSelectedIndex: 0, autoSetSelectedText: true) { (textField, selectedIndex, selectedValue) in print(selectedValue) } view.addSubview(test)

    singleTextField.showSingleColPicker("编程语言选择", data: singleData, defaultSelectedIndex: 2, autoSetSelectedText: true) {[unowned self] (textField, selectedIndex, selectedValue) in
        //  可以使用textField 也可以使用 self.singleTextField
        textField.text = "选中了第\(selectedIndex)行----选中的数据为\(selectedValue)"
        self.selectedDataLabel.text = "选中了第\(selectedIndex)行----选中的数据为\(selectedValue)"

    }

####2. 按钮使用.在点击事件的方法里面 UsefulPickerView.showSingleColPicker("编程语言选择", data: singleData, defaultSelectedIndex: 2) {[unowned self] (selectedIndex, selectedValue) in self.selectedDataLabel.text = "选中了第(selectedIndex)行----选中的数据为(selectedValue)" } UsefulPickerView.showMultipleColsPicker("持续时间选择", data: multipleData, defaultSelectedIndexs: [0,1,1]) {[unowned self] (selectedIndexs, selectedValues) in self.selectedDataLabel.text = "选中了第(selectedIndexs)行----选中的数据为(selectedValues)"

    }

####如果你在使用中遇到问题: 可以通过简书私信给我

License

UsefulPickerView is released under the MIT license. See LICENSE for details.

usefulpickerview's People

Contributors

jasnig avatar shiweifu avatar isandboy avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.