Commit ab0f186c by Daniel Dahan

updated README with TextField

parent 2bfceb08
...@@ -28,11 +28,11 @@ Run carthage to build the framework and drag the built MaterialKit.framework int ...@@ -28,11 +28,11 @@ Run carthage to build the framework and drag the built MaterialKit.framework int
### Table of Contents ### Table of Contents
* [TextView](#textview)
* [MaterialColor](#materialcolor) * [MaterialColor](#materialcolor)
* [MaterialLayer](#materiallayer) * [MaterialLayer](#materiallayer)
* [MaterialView](#materialview) * [MaterialView](#materialview)
* [MaterialPulseView](#materialpulseview) * [MaterialPulseView](#materialpulseview)
* [TextField](#textfield)
* [FlatButton](#flatbutton) * [FlatButton](#flatbutton)
* [RaisedButton](#raisedbutton) * [RaisedButton](#raisedbutton)
* [FabButton](#fabbutton) * [FabButton](#fabbutton)
...@@ -52,15 +52,6 @@ Run carthage to build the framework and drag the built MaterialKit.framework int ...@@ -52,15 +52,6 @@ Run carthage to build the framework and drag the built MaterialKit.framework int
* Scrolling Techniques * Scrolling Techniques
* More Examples * More Examples
<a name="textview"/>
### TextField
A TextField is a great option to increase UX. Below is an example.
Space on mobile devices
![MaterialKitTextField](http://www.materialkit.io/MK/MaterialKitTextField.gif)
<a name="materialcolor"/> <a name="materialcolor"/>
### MaterialColor ### MaterialColor
...@@ -125,6 +116,13 @@ materialPulseView.shadowDepth = .Depth2 ...@@ -125,6 +116,13 @@ materialPulseView.shadowDepth = .Depth2
view.addSubview(materialPulseView) view.addSubview(materialPulseView)
``` ```
<a name="textfield"/>
### TextField
A TextField is an excellent way to improve UX. Checkout the Examples directory for a project using this component.
![MaterialKitTextField](http://www.materialkit.io/MK/MaterialKitTextField.gif)
<a name="flatbutton"/> <a name="flatbutton"/>
### FlatButton ### FlatButton
......
...@@ -89,6 +89,7 @@ public class TextField : UITextField { ...@@ -89,6 +89,7 @@ public class TextField : UITextField {
*/ */
internal func textFieldDidBegin(textField: TextField) { internal func textFieldDidBegin(textField: TextField) {
count = text?.utf16.count count = text?.utf16.count
titleLabel?.text = placeholder
titleLabel?.textColor = 0 == count ? titleLabelNormalColor : titleLabelHighlightedColor titleLabel?.textColor = 0 == count ? titleLabelNormalColor : titleLabelHighlightedColor
} }
...@@ -152,7 +153,6 @@ public class TextField : UITextField { ...@@ -152,7 +153,6 @@ public class TextField : UITextField {
v.hidden = true v.hidden = true
v.alpha = 0 v.alpha = 0
} }
v.text = placeholder
let h: CGFloat = v.font.stringSize(v.text!, constrainedToWidth: Double(bounds.width)).height let h: CGFloat = v.font.stringSize(v.text!, constrainedToWidth: Double(bounds.width)).height
v.frame = CGRectMake(0, -h, bounds.width, h) v.frame = CGRectMake(0, -h, bounds.width, h)
addSubview(v) addSubview(v)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment