Commit a5c2a3df by Daniel Dahan

updated README with TextField

parent ab0f186c
......@@ -29,10 +29,10 @@ Run carthage to build the framework and drag the built MaterialKit.framework int
### Table of Contents
* [MaterialColor](#materialcolor)
* [TextField](#textfield)
* [MaterialLayer](#materiallayer)
* [MaterialView](#materialview)
* [MaterialPulseView](#materialpulseview)
* [TextField](#textfield)
* [FlatButton](#flatbutton)
* [RaisedButton](#raisedbutton)
* [FabButton](#fabbutton)
......@@ -64,6 +64,28 @@ let button: FabButton = FabButton()
button.backgroundColor = MaterialColor.blue.darken1
```
<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)
```swift
let titleField: TextField = TextField(frame: CGRectMake(57, 100, 300, 24))
titleField.delegate = self
titleField.placeholder = "Title"
titleField.font = RobotoFont.regularWithSize(20)
titleField.textColor = MaterialColor.black
titleField.titleLabel = UILabel()
titleField.titleLabel!.font = RobotoFont.mediumWithSize(12)
titleField.titleLabelNormalColor = MaterialColor.grey.lighten1
titleField.titleLabelHighlightedColor = MaterialColor.blue.accent3
// Add titleField to UIViewController.
view.addSubview(titleField)
```
<a name="materiallayer"/>
### MaterialLayer
......@@ -116,13 +138,6 @@ materialPulseView.shadowDepth = .Depth2
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"/>
### FlatButton
......
......@@ -153,6 +153,7 @@ public class TextField : UITextField {
v.hidden = true
v.alpha = 0
}
titleLabel?.text = placeholder
let h: CGFloat = v.font.stringSize(v.text!, constrainedToWidth: Double(bounds.width)).height
v.frame = CGRectMake(0, -h, bounds.width, h)
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