Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcgill88 committed Mar 10, 2018
1 parent ac67df5 commit e95c4ed
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Example/McPicker/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
</navigationItem>
<connections>
<outlet property="label" destination="fEx-GG-5Tp" id="alK-q4-pWv"/>
<outlet property="textField" destination="r6o-nf-hyx" id="rqF-zy-X7O"/>
<outlet property="mcTextField" destination="r6o-nf-hyx" id="8b2-vH-yzf"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
Expand Down
24 changes: 12 additions & 12 deletions Example/McPicker/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import McPicker

class ViewController: UIViewController {

@IBOutlet weak var textField: McTextField!
@IBOutlet weak var mcTextField: McTextField!
@IBOutlet weak var label: UILabel!
let data: [[String]] = [
["Kevin", "Lauren", "Kibby", "Stella"]
Expand All @@ -35,20 +35,20 @@ class ViewController: UIViewController {
let mcInputView = McPicker(data: data)
mcInputView.backgroundColor = .gray
mcInputView.backgroundColorAlpha = 0.25
textField.inputViewMcPicker = mcInputView
textField.doneHandler = { [weak textField] (selections) in
textField?.text = selections[0]!
mcTextField.inputViewMcPicker = mcInputView
mcTextField.doneHandler = { [weak mcTextField] (selections) in
mcTextField?.text = selections[0]!
}
textField.selectionChangedHandler = { [weak textField] (selections, componentThatChanged) in
textField?.text = selections[componentThatChanged]!
mcTextField.selectionChangedHandler = { [weak mcTextField] (selections, componentThatChanged) in
mcTextField?.text = selections[componentThatChanged]!
}
textField.cancelHandler = { [weak textField] in
textField?.text = "Cancelled."
mcTextField.cancelHandler = { [weak mcTextField] in
mcTextField?.text = "Cancelled."
}
textField.textFieldWillBeginEditingHandler = { [weak textField] (selections) in
if textField?.text == "" {
mcTextField.textFieldWillBeginEditingHandler = { [weak mcTextField] (selections) in
if mcTextField?.text == "" {
// Selections always default to the first value per component
textField?.text = selections[0]
mcTextField?.text = selections[0]
}
}
}
Expand Down Expand Up @@ -112,7 +112,7 @@ class ViewController: UIViewController {

mcPicker.pickerSelectRowsForComponents = [
0: [3: true],
1: [2: true]
1: [2: true] // [Component: [Row: isAnimated]
]

if let barButton = sender as? UIBarButtonItem {
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2017 Kevin McGill <kevin@mcgilldevtech.com>
Copyright (c) 2017-2018 Kevin McGill <kevin@mcgilldevtech.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ McPicker is a UIPickerView drop-in solution with animations that is rotation rea
## Usage
To run the example project, clone the repo, and run `pod install` from the Example directory first.

![](https://mcgilldevtech.com/img/github/mcpicker/mcpicker-1.0.0-ios.gif)
![](https://mcgilldevtech.com/img/github/mcpicker/mcpicker-1.0.0-3.gif)

#### Short Syntax
- Normal - (Slide up from bottom)
Expand All @@ -34,26 +34,27 @@ McPicker.showAsPopover(data: data, fromViewController: self, barButtonItem: send
```
- As an `inputView` via `McTextField`
```swift
@IBOutlet weak var textField: McTextField!
@IBOutlet weak var mcTextField: McTextField!
override func viewDidLoad() {
let data: [[String]] = [["Kevin", "Lauren", "Kibby", "Stella"]]
let mcInputView = McPicker(data: data)
mcInputView.backgroundColor = .gray
mcInputView.backgroundColorAlpha = 0.25
textField.inputViewMcPicker = mcInputView
textField.doneHandler = { [weak textField] (selections) in
textField?.text = selections[0]!
mcTextField.inputViewMcPicker = mcInputView

mcTextField.doneHandler = { [weak mcTextField] (selections) in
mcTextField?.text = selections[0]!
}
textField.selectionChangedHandler = { [weak textField] (selections, componentThatChanged) in
textField?.text = selections[componentThatChanged]!
mcTextField.selectionChangedHandler = { [weak mcTextField] (selections, componentThatChanged) in
mcTextField?.text = selections[componentThatChanged]!
}
textField.cancelHandler = { [weak textField] in
textField?.text = "Cancelled."
mcTextField.cancelHandler = { [weak mcTextField] in
mcTextField?.text = "Cancelled."
}
textField.textFieldWillBeginEditingHandler = { [weak textField] (selections) in
if textField?.text == "" {
mcTextField.textFieldWillBeginEditingHandler = { [weak mcTextField] (selections) in
if mcTextField?.text == "" {
// Selections always default to the first value per component
textField?.text = selections[0]
mcTextField?.text = selections[0]
}
}
}
Expand All @@ -77,19 +78,18 @@ let fixedSpace = McPickerBarButtonItem.fixedSpace(width: 20.0)
let flexibleSpace = McPickerBarButtonItem.flexibleSpace()
let fireButton = McPickerBarButtonItem.done(mcPicker: mcPicker, title: "Fire!!!") // Set custom Text
let cancelButton = McPickerBarButtonItem.cancel(mcPicker: mcPicker, barButtonSystemItem: .cancel) // or system items
// Set custom toolbar items
mcPicker.setToolbarItems(items: [fixedSpace, cancelButton, flexibleSpace, fireButton, fixedSpace])

mcPicker.toolbarItemsFont = UIFont(name:"American Typewriter", size: 17)!

mcPicker.toolbarButtonsColor = .white
mcPicker.toolbarBarTintColor = .darkGray
mcPicker.pickerBackgroundColor = .gray
mcPicker.backgroundColor = .gray
mcPicker.backgroundColorAlpha = 0.50

mcPicker.pickerBackgroundColor = .gray
mcPicker.pickerSelectRowsForComponents = [
0: [3: true],
1: [2: true]
1: [2: true] // [Component: [Row: isAnimated]
]

if let barButton = sender as? UIBarButtonItem {
Expand Down

0 comments on commit e95c4ed

Please sign in to comment.