Commit a70e2660 by Daniel Dahan

added ImageCardView example 2

parent 2f41ae65
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -40,7 +40,8 @@ class ViewController: UIViewController {
// Examples of using CardView.
// Uncomment different examples and read
// the comments below.
prepareGeneralImageCardViewExample()
// prepareGeneralImageCardViewExample()
prepareImageCardViewWithoutDetailLabelAndDividerExample()
}
/**
......@@ -99,6 +100,63 @@ class ViewController: UIViewController {
imageCardView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTop(view, child: imageCardView, top: 100)
MaterialLayout.alignToParentHorizontally(view, child: imageCardView, left: 20, right: 20)
}
/**
:name: prepareImageCardViewWithoutDetailLabelAndDividerExample
:description: The following example removes the detailLabel to create a new look and feel to the general example.
*/
private func prepareImageCardViewWithoutDetailLabelAndDividerExample() {
let imageCardView: ImageCardView = ImageCardView()
imageCardView.divider = false
// Image.
imageCardView.image = UIImage(named: "MaterialKitImageCardViewBackgroundImage")
// Title label.
let titleLabel: UILabel = UILabel()
titleLabel.text = "Material Design"
titleLabel.textColor = MaterialColor.white
titleLabel.font = RobotoFont.regularWithSize(24)
imageCardView.titleLabel = titleLabel
imageCardView.titleLabelInsetsRef.top = 80
// Check button.
let img1: UIImage? = UIImage(named: "ic_check_blue_grey_darken_4")
let btn1: FlatButton = FlatButton()
btn1.pulseColor = MaterialColor.blueGrey.lighten1
btn1.pulseFill = true
btn1.pulseScale = false
btn1.setImage(img1, forState: .Normal)
btn1.setImage(img1, forState: .Highlighted)
// Star button.
let img2: UIImage? = UIImage(named: "ic_star_blue_grey_darken_4")
let btn2: FlatButton = FlatButton()
btn2.pulseColor = MaterialColor.blueGrey.lighten1
btn2.pulseFill = true
btn2.pulseScale = false
btn2.setImage(img2, forState: .Normal)
btn2.setImage(img2, forState: .Highlighted)
// Delete button.
let img3: UIImage? = UIImage(named: "ic_delete_blue_grey_darken_4")
let btn3: FlatButton = FlatButton()
btn3.pulseColor = MaterialColor.blueGrey.lighten1
btn3.pulseFill = true
btn3.pulseScale = false
btn3.setImage(img3, forState: .Normal)
btn3.setImage(img3, forState: .Highlighted)
// Add buttons to right side.
imageCardView.rightButtons = [btn1, btn2, btn3]
imageCardView.rightButtonsInsetsRef.top = imageCardView.contentInsetsRef.top
// To support orientation changes, use MaterialLayout.
view.addSubview(imageCardView)
imageCardView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTop(view, child: imageCardView, top: 100)
MaterialLayout.alignToParentHorizontally(view, child: imageCardView, left: 20, right: 20)
}
}
......
......@@ -42,6 +42,10 @@ Bold and attractive, ImageCardView is the next step from a CardView. In the Exam
![MaterialKitImageCardView](http://www.materialkit.io/MK/MaterialKitImageCardView.gif)
Remove elements, such as the details to create fresh looks for your images.
![MaterialKitImageCardViewBackgroundImage](http://www.materialkit.io/MK/MaterialKitImageCardViewBackgroundImage.gif)
### License
[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