Commit 418f4090 by Daniel Dahan

development: added PresenterCard sample project and reworked Cards

parent b701f1b7
......@@ -41,9 +41,9 @@ class ViewController: UIViewController {
super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5
prepareFavoriteButton()
prepareToolbar()
prepareContentView()
prepareFavoriteButton()
prepareBottomBar()
prepareCard()
}
......@@ -78,6 +78,7 @@ class ViewController: UIViewController {
card.toolbar = toolbar
card.contentView = contentView
card.bottomBar = bottomBar
card.cornerRadiusPreset = .cornerRadius1
view.layout(card).top(100).left(20).right(20)
}
......
......@@ -42,11 +42,11 @@ class ViewController: UIViewController {
super.viewDidLoad()
view.backgroundColor = Color.grey.lighten5
prepareFavoriteButton()
prepareBottomBar()
prepareImageView()
prepareToolbar()
prepareContentView()
prepareFavoriteButton()
prepareBottomBar()
prepareImageCard()
}
......@@ -55,6 +55,7 @@ class ViewController: UIViewController {
imageView.image = UIImage(named: "frontier.jpg")?.resize(toWidth: view.width)
imageView.clipsToBounds = true
imageView.contentMode = .scaleAspectFill
imageView.cornerRadiusPreset = .cornerRadius1
}
private func prepareToolbar() {
......@@ -98,6 +99,7 @@ class ViewController: UIViewController {
card.contentView = contentView
card.bottomBar = bottomBar
card.contentEdgeInsetsPreset = .square3
card.cornerRadiusPreset = .cornerRadius1
imageView?.layout(toolbar!).height(toolbar!.height + 32)
view.layout(card).top(100).left(20).right(20)
......
......@@ -45,11 +45,11 @@ class ViewController: UIViewController {
view.backgroundColor = Color.grey.lighten5
prepareImageView()
prepareToolbar()
prepareContentView()
prepareFavoriteButton()
prepareShareButton()
prepareStarButton()
prepareToolbar()
prepareContentView()
prepareBottomBar()
prepareImageCard()
}
......@@ -59,6 +59,7 @@ class ViewController: UIViewController {
imageView.image = UIImage(named: "frontier.jpg")?.resize(toWidth: view.width)
imageView.clipsToBounds = true
imageView.contentMode = .scaleAspectFill
imageView.cornerRadiusPreset = .cornerRadius1
}
private func prepareToolbar() {
......@@ -74,6 +75,13 @@ class ViewController: UIViewController {
toolbar.contentEdgeInsetsPreset = .square3
toolbar.backgroundColor = nil
toolbar.rightViews.append(starButton)
}
@objc
internal func handleButton(button: UIButton) {
print("hello")
}
private func prepareContentView() {
......@@ -97,15 +105,16 @@ class ViewController: UIViewController {
private func prepareStarButton() {
starButton = FlatButton(image: Icon.cm.star, tintColor: Color.grey.base)
starButton.pulse.color = Color.grey.base
starButton.grid.columns = 4
starButton.pulse.color = Color.green.base
starButton.addTarget(self, action: #selector(handleButton(button:)), for: .touchUpInside)
// starButton.grid.columns = 4
}
private func prepareBottomBar() {
bottomBar = Bar()
bottomBar.backgroundColor = nil
bottomBar.contentEdgeInsetsPreset = .square1
bottomBar.contentView.grid.views = [favoriteButton, shareButton, starButton]
bottomBar.contentView.grid.views = [favoriteButton, shareButton]
}
private func prepareImageCard() {
......@@ -115,6 +124,7 @@ class ViewController: UIViewController {
card.contentView = contentView
card.bottomBar = bottomBar
card.contentEdgeInsetsPreset = .square3
card.cornerRadiusPreset = .cornerRadius1
imageView?.layout(toolbar!).height(toolbar!.height + 32)
view.layout(card).top(100).left(20).right(20)
......
......@@ -174,7 +174,7 @@ open class Card: PulseView {
open override func prepare() {
super.prepare()
depthPreset = .depth1
cornerRadiusPreset = .cornerRadius1
pulse.animation = .none
}
/**
......
......@@ -97,6 +97,7 @@ open class PresenterCard: Card {
addConstraints(Layout.constraint(format: "\(format)|", options: [], metrics: metrics, views: views))
presenterView?.zPosition = 0
toolbar?.zPosition = 1000
visualLayer.zPosition = 1
contentView?.zPosition = 2
bottomBar?.zPosition = 2
......
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