项目作者: blaineb

项目描述 :
iOS-style wheel picker for Framer
高级语言: CoffeeScript
项目地址: git://github.com/blaineb/framer-picker.git
创建时间: 2017-12-09T01:30:56Z
项目社区:https://github.com/blaineb/framer-picker

开源协议:

下载


framer-picker

iOS-style wheel picker for Framer

Usage

Drop it into your prototype and put this in the top line:

  1. {Picker} = require 'picker'

Simple example

Pass an array to drum for a simple, one-drum picker
```picker = new Picker
drum: [“Option A”,”Option B”,”Option C”,”Option D”]

  1. ## Multi-drums
  2. 1. Create an array of objects make your drum.

drumContent = [
{
options: [“Option A”,”Option B”,”Option C”,”Option D”] # Array of options.
width: Screen.width / 2 # Specificy a width. You’ll need to do this.
textAlign: “right” # Optionally, change the alignment.
},
{
options: [“Z”, “Y”, “X”, “W”, “V”, “U”,”T”]
startIndex: 3
width: Screen.width / 2
textAlign: “left”
}
]

  1. 2. Initialize the picker.

multiPicker = new Picker
drums: drumContent

  1. You can use the "hidden" state to switch between it being visible or not
  2. `multiPicker.stateSwitch "hidden"`
  3. ...And bring it back with the default state.
  4. `multiPicker.animate "default"`
  5. Each drum is accessed with dot syntax, like `multiPicker.drum0`, `multiPicker.drum1`, etc...
  6. You can access the value like so

multiPicker.drum0.on “change:currentPage”, ->
print @.value

  1. Access the toolbar with `multiPicker.toolbar`. To close the picker when tapping "Done":

multiPicker.toolbar.onTap ->
timePicker.stateSwitch “hidden”
```