Commit 75013611 by Daniel Dahan

updated MaterialView example

parent 156d0359
...@@ -43,12 +43,12 @@ class ViewController: UIViewController { ...@@ -43,12 +43,12 @@ class ViewController: UIViewController {
:description: FlatButton example. :description: FlatButton example.
*/ */
private func prepareFlatButtonExample() { private func prepareFlatButtonExample() {
let v: FlatButton = FlatButton(frame: CGRectMake(107, 107, 200, 65)) let button: FlatButton = FlatButton(frame: CGRectMake(107, 107, 200, 65))
v.setTitle("Flat", forState: .Normal) button.setTitle("Flat", forState: .Normal)
v.titleLabel!.font = RobotoFont.mediumWithSize(32) button.titleLabel!.font = RobotoFont.mediumWithSize(32)
// Add to UIViewController. // Add to UIViewController.
view.addSubview(v) view.addSubview(button)
} }
/** /**
...@@ -56,12 +56,12 @@ class ViewController: UIViewController { ...@@ -56,12 +56,12 @@ class ViewController: UIViewController {
:description: RaisedButton example. :description: RaisedButton example.
*/ */
private func prepareRaisedButtonExample() { private func prepareRaisedButtonExample() {
let v: RaisedButton = RaisedButton(frame: CGRectMake(107, 207, 200, 65)) let button: RaisedButton = RaisedButton(frame: CGRectMake(107, 207, 200, 65))
v.setTitle("Raised", forState: .Normal) button.setTitle("Raised", forState: .Normal)
v.titleLabel!.font = RobotoFont.mediumWithSize(32) button.titleLabel!.font = RobotoFont.mediumWithSize(32)
// Add to UIViewController. // Add to UIViewController.
view.addSubview(v) view.addSubview(button)
} }
/** /**
...@@ -69,12 +69,13 @@ class ViewController: UIViewController { ...@@ -69,12 +69,13 @@ class ViewController: UIViewController {
:description: FabButton example. :description: FabButton example.
*/ */
private func prepareFabButtonExample() { private func prepareFabButtonExample() {
let v: FabButton = FabButton(frame: CGRectMake(175, 315, 64, 64)) let img: UIImage? = UIImage(named: "ic_create_white")
v.setImage(UIImage(named: "ic_create_white"), forState: .Normal) let button: FabButton = FabButton(frame: CGRectMake(175, 315, 64, 64))
v.setImage(UIImage(named: "ic_create_white"), forState: .Highlighted) button.setImage(img, forState: .Normal)
button.setImage(img, forState: .Highlighted)
// Add to UIViewController. // Add to UIViewController.
view.addSubview(v) view.addSubview(button)
} }
} }
...@@ -46,7 +46,7 @@ class ViewController: UIViewController { ...@@ -46,7 +46,7 @@ class ViewController: UIViewController {
materialLayer.shape = .Circle materialLayer.shape = .Circle
materialLayer.shadowDepth = .Depth2 materialLayer.shadowDepth = .Depth2
// Add layer to view. // Add layer to UIViewController.
view.layer.addSublayer(materialLayer) view.layer.addSublayer(materialLayer)
} }
} }
......
...@@ -47,8 +47,7 @@ class ViewController: UIViewController { ...@@ -47,8 +47,7 @@ class ViewController: UIViewController {
materialView.shadowDepth = .Depth5 materialView.shadowDepth = .Depth5
materialView.cornerRadius = .Radius3 materialView.cornerRadius = .Radius3
// Add view to UIViewController.
// Add view to view controller.
view.addSubview(materialView) view.addSubview(materialView)
} }
} }
......
...@@ -19,6 +19,9 @@ let materialLayer: MaterialLayer = MaterialLayer(frame: CGRectMake(132, 132, 150 ...@@ -19,6 +19,9 @@ let materialLayer: MaterialLayer = MaterialLayer(frame: CGRectMake(132, 132, 150
materialLayer.image = UIImage(named: "BluePattern") materialLayer.image = UIImage(named: "BluePattern")
materialLayer.shape = .Circle materialLayer.shape = .Circle
materialLayer.shadowDepth = .Depth2 materialLayer.shadowDepth = .Depth2
// Add layer to UIViewController.
view.layer.addSublayer(materialLayer)
``` ```
### MaterialView ### MaterialView
...@@ -33,12 +36,61 @@ materialView.image = UIImage(named: "Flower") ...@@ -33,12 +36,61 @@ materialView.image = UIImage(named: "Flower")
materialView.shape = .Square materialView.shape = .Square
materialView.shadowDepth = .Depth5 materialView.shadowDepth = .Depth5
materialView.cornerRadius = .Radius3 materialView.cornerRadius = .Radius3
// Add view to UIViewController.
view.addSubview(materialView)
``` ```
### MaterialPulseView ### MaterialPulseView
MaterialPulseView is MaterialPulseView is
### FlatButton
A FlatButton is the best place to start when introducing MaterialKit buttons. It is simple, clean, and very effective. Below is an example of a FlatButton in action.
![MaterialKitFlatButton](http://www.materialkit.io/MK/MaterialKitFlatButton.gif)
```swift
let button: FlatButton = FlatButton(frame: CGRectMake(107, 107, 200, 65))
button.setTitle("Flat", forState: .Normal)
button.titleLabel!.font = RobotoFont.mediumWithSize(32)
// Add to UIViewController.
view.addSubview(button)
```
### RaisedButton
A RaisedButton is sure to get attention. Take a look at the following animation example.
![MaterialKitRaisedButton](http://www.materialkit.io/MK/MaterialKitRaisedButton.gif)
```swift
let button: RaisedButton = RaisedButton(frame: CGRectMake(107, 207, 200, 65))
button.setTitle("Raised", forState: .Normal)
button.titleLabel!.font = RobotoFont.mediumWithSize(32)
// Add to UIViewController.
view.addSubview(button)
```
### FabButton
A FabButton is essential to Material Design's overall look. Below showcases its beauty.
![MaterialKitFabButton](http://www.materialkit.io/MK/MaterialKitFabButton.gif)
```swift
let img: UIImage? = UIImage(named: "ic_create_white")
let button: FabButton = FabButton(frame: CGRectMake(175, 315, 64, 64))
button.setImage(img, forState: .Normal)
button.setImage(img, forState: .Highlighted)
// Add to UIViewController.
view.addSubview(button)
```
### NavigationBarView ### NavigationBarView
One of Material Design's greatest additions to UI is the NavigationBarView. In the Examples folder, you can checkout some code to get you started with this wonderful component. One of Material Design's greatest additions to UI is the NavigationBarView. In the Examples folder, you can checkout some code to get you started with this wonderful component.
...@@ -314,24 +366,6 @@ Remove elements, such as the details to create a fresh look for your images. ...@@ -314,24 +366,6 @@ Remove elements, such as the details to create a fresh look for your images.
![MaterialKitImageCardViewBackgroundImage](http://www.materialkit.io/MK/MaterialKitImageCardViewBackgroundImage.gif) ![MaterialKitImageCardViewBackgroundImage](http://www.materialkit.io/MK/MaterialKitImageCardViewBackgroundImage.gif)
### FlatButton
A FlatButton is the best place to start when introducing MaterialKit buttons. It is simple, clean, and very effective. Below is an example of a FlatButton in action.
![MaterialKitFlatButton](http://www.materialkit.io/MK/MaterialKitFlatButton.gif)
### RaisedButton
A RaisedButton is sure to get attention. Take a look at the following animation example.
![MaterialKitRaisedButton](http://www.materialkit.io/MK/MaterialKitRaisedButton.gif)
### FabButton
A FabButton is essential to Material Design's overall look. Below showcases its beauty.
![MaterialKitFabButton](http://www.materialkit.io/MK/MaterialKitFabButton.gif)
### License ### License
[AGPL-3.0](http://choosealicense.com/licenses/agpl-3.0/) [AGPL-3.0](http://choosealicense.com/licenses/agpl-3.0/)
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