Commit d7c78951 by Daniel Dahan

updated MaterialLayout to Layout

parent 003323d6
...@@ -98,11 +98,11 @@ class AppLeftViewController: UIViewController { ...@@ -98,11 +98,11 @@ class AppLeftViewController: UIViewController {
nameLabel.font = RobotoFont.mediumWithSize(18) nameLabel.font = RobotoFont.mediumWithSize(18)
view.addSubview(nameLabel) view.addSubview(nameLabel)
MaterialLayout.alignFromTopLeft(view, child: profileView, top: 30, left: (view.bounds.width - 72) / 2) Layout.alignFromTopLeft(view, child: profileView, top: 30, left: (view.bounds.width - 72) / 2)
MaterialLayout.size(view, child: profileView, width: 72, height: 72) Layout.size(view, child: profileView, width: 72, height: 72)
MaterialLayout.alignFromTop(view, child: nameLabel, top: 130) Layout.alignFromTop(view, child: nameLabel, top: 130)
MaterialLayout.alignToParentHorizontally(view, child: nameLabel, left: 20, right: 20) Layout.alignToParentHorizontally(view, child: nameLabel, left: 20, right: 20)
} }
/// Prepares the tableView. /// Prepares the tableView.
...@@ -113,9 +113,9 @@ class AppLeftViewController: UIViewController { ...@@ -113,9 +113,9 @@ class AppLeftViewController: UIViewController {
tableView.delegate = self tableView.delegate = self
tableView.separatorStyle = .None tableView.separatorStyle = .None
// Use MaterialLayout to easily align the tableView. // Use Layout to easily align the tableView.
view.addSubview(tableView) view.addSubview(tableView)
MaterialLayout.alignToParent(view, child: tableView, top: 170) Layout.alignToParent(view, child: tableView, top: 170)
} }
} }
......
...@@ -141,8 +141,8 @@ class AppMenuController: MenuController { ...@@ -141,8 +141,8 @@ class AppMenuController: MenuController {
menuView.delegate = self menuView.delegate = self
view.addSubview(menuView) view.addSubview(menuView)
MaterialLayout.size(view, child: menuView, width: baseSize.width, height: baseSize.height) Layout.size(view, child: menuView, width: baseSize.width, height: baseSize.height)
MaterialLayout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset) Layout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset)
} }
/// Prepare tabBarItem. /// Prepare tabBarItem.
......
...@@ -52,9 +52,9 @@ class AppNavigationController: NavigationController { ...@@ -52,9 +52,9 @@ class AppNavigationController: NavigationController {
// statusBarView!.backgroundColor = MaterialColor.blue.darken2 // statusBarView!.backgroundColor = MaterialColor.blue.darken2
// //
// view.addSubview(statusBarView!) // view.addSubview(statusBarView!)
// MaterialLayout.alignFromTop(view, child: statusBarView!) // Layout.alignFromTop(view, child: statusBarView!)
// MaterialLayout.alignToParentHorizontally(view, child: statusBarView!) // Layout.alignToParentHorizontally(view, child: statusBarView!)
// MaterialLayout.height(view, child: statusBarView!, height: 20) // Layout.height(view, child: statusBarView!, height: 20)
// } // }
/// Prepares the navigationBar /// Prepares the navigationBar
......
...@@ -95,7 +95,7 @@ class ItemViewController: UIViewController { ...@@ -95,7 +95,7 @@ class ItemViewController: UIViewController {
scrollView.frame = view.bounds scrollView.frame = view.bounds
scrollView.removeConstraints(scrollView.constraints) scrollView.removeConstraints(scrollView.constraints)
MaterialLayout.width(scrollView, child: imageCardView, width: scrollView.bounds.width) Layout.width(scrollView, child: imageCardView, width: scrollView.bounds.width)
imageCardView.layoutIfNeeded() imageCardView.layoutIfNeeded()
scrollView.contentSize = CGSizeMake(view.bounds.width, imageCardView.height) scrollView.contentSize = CGSizeMake(view.bounds.width, imageCardView.height)
......
...@@ -260,9 +260,9 @@ class RecipesViewController: UIViewController { ...@@ -260,9 +260,9 @@ class RecipesViewController: UIViewController {
tableView.dataSource = self tableView.dataSource = self
tableView.delegate = self tableView.delegate = self
// Use MaterialLayout to easily align the tableView. // Use Layout to easily align the tableView.
view.addSubview(tableView) view.addSubview(tableView)
MaterialLayout.alignToParent(view, child: tableView) Layout.alignToParent(view, child: tableView)
} }
} }
...@@ -308,7 +308,7 @@ extension RecipesViewController: UITableViewDataSource { ...@@ -308,7 +308,7 @@ extension RecipesViewController: UITableViewDataSource {
label.text = "Favorites" label.text = "Favorites"
header.addSubview(label) header.addSubview(label)
MaterialLayout.alignToParent(header, child: label, left: 24) Layout.alignToParent(header, child: label, left: 24)
return header return header
} }
......
...@@ -69,9 +69,9 @@ class RecommendationViewController: UIViewController { ...@@ -69,9 +69,9 @@ class RecommendationViewController: UIViewController {
tableView.dataSource = self tableView.dataSource = self
tableView.delegate = self tableView.delegate = self
// Use MaterialLayout to easily align the tableView. // Use Layout to easily align the tableView.
view.addSubview(tableView) view.addSubview(tableView)
MaterialLayout.alignToParent(view, child: tableView) Layout.alignToParent(view, child: tableView)
} }
} }
...@@ -117,7 +117,7 @@ extension RecommendationViewController: UITableViewDataSource { ...@@ -117,7 +117,7 @@ extension RecommendationViewController: UITableViewDataSource {
label.text = "Recommendations" label.text = "Recommendations"
header.addSubview(label) header.addSubview(label)
MaterialLayout.alignToParent(header, child: label, left: 24) Layout.alignToParent(header, child: label, left: 24)
return header return header
} }
......
...@@ -226,7 +226,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg ...@@ -226,7 +226,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
captureView.tapToExposeEnabled = true captureView.tapToExposeEnabled = true
captureView.delegate = self captureView.delegate = self
captureView.captureSession.delegate = self captureView.captureSession.delegate = self
MaterialLayout.alignToParent(view, child: captureView) Layout.alignToParent(view, child: captureView)
} }
/** /**
......
...@@ -78,10 +78,10 @@ class ViewController: UIViewController { ...@@ -78,10 +78,10 @@ class ViewController: UIViewController {
// Add buttons to left side. // Add buttons to left side.
cardView.leftButtons = [btn1, btn2] cardView.leftButtons = [btn1, btn2]
// To support orientation changes, use MaterialLayout. // To support orientation changes, use Layout.
view.addSubview(cardView) view.addSubview(cardView)
MaterialLayout.alignFromTop(view, child: cardView, top: 100) Layout.alignFromTop(view, child: cardView, top: 100)
MaterialLayout.alignToParentHorizontally(view, child: cardView, left: 20, right: 20) Layout.alignToParentHorizontally(view, child: cardView, left: 20, right: 20)
} }
private func prepareCardViewWithoutPulseBackgroundImageExample() { private func prepareCardViewWithoutPulseBackgroundImageExample() {
...@@ -117,10 +117,10 @@ class ViewController: UIViewController { ...@@ -117,10 +117,10 @@ class ViewController: UIViewController {
// Add buttons to left side. // Add buttons to left side.
cardView.leftButtons = [btn1] cardView.leftButtons = [btn1]
// To support orientation changes, use MaterialLayout. // To support orientation changes, use Layout.
view.addSubview(cardView) view.addSubview(cardView)
MaterialLayout.alignFromTop(view, child: cardView, top: 100) Layout.alignFromTop(view, child: cardView, top: 100)
MaterialLayout.alignToParentHorizontally(view, child: cardView, left: 20, right: 20) Layout.alignToParentHorizontally(view, child: cardView, left: 20, right: 20)
} }
private func prepareCardViewWithPulseBackgroundImageExample() { private func prepareCardViewWithPulseBackgroundImageExample() {
...@@ -157,10 +157,10 @@ class ViewController: UIViewController { ...@@ -157,10 +157,10 @@ class ViewController: UIViewController {
// Add buttons to left side. // Add buttons to left side.
cardView.leftButtons = [btn1] cardView.leftButtons = [btn1]
// To support orientation changes, use MaterialLayout. // To support orientation changes, use Layout.
view.addSubview(cardView) view.addSubview(cardView)
MaterialLayout.alignFromTop(view, child: cardView, top: 100) Layout.alignFromTop(view, child: cardView, top: 100)
MaterialLayout.alignToParentHorizontally(view, child: cardView, left: 20, right: 20) Layout.alignToParentHorizontally(view, child: cardView, left: 20, right: 20)
} }
private func prepareCardViewButtonBarExample() { private func prepareCardViewButtonBarExample() {
...@@ -196,10 +196,10 @@ class ViewController: UIViewController { ...@@ -196,10 +196,10 @@ class ViewController: UIViewController {
// Add buttons to right side. // Add buttons to right side.
cardView.rightButtons = [btn2, btn3] cardView.rightButtons = [btn2, btn3]
// To support orientation changes, use MaterialLayout. // To support orientation changes, use Layout.
view.addSubview(cardView) view.addSubview(cardView)
MaterialLayout.alignFromTop(view, child: cardView, top: 100) Layout.alignFromTop(view, child: cardView, top: 100)
MaterialLayout.alignToParentHorizontally(view, child: cardView, left: 20, right: 20) Layout.alignToParentHorizontally(view, child: cardView, left: 20, right: 20)
} }
} }
...@@ -82,10 +82,10 @@ class ViewController: UIViewController { ...@@ -82,10 +82,10 @@ class ViewController: UIViewController {
// Add buttons to left side. // Add buttons to left side.
imageCardView.leftButtons = [btn1, btn2] imageCardView.leftButtons = [btn1, btn2]
// To support orientation changes, use MaterialLayout. // To support orientation changes, use Layout.
view.addSubview(imageCardView) view.addSubview(imageCardView)
MaterialLayout.alignFromTop(view, child: imageCardView, top: 100) Layout.alignFromTop(view, child: imageCardView, top: 100)
MaterialLayout.alignToParentHorizontally(view, child: imageCardView, left: 20, right: 20) Layout.alignToParentHorizontally(view, child: imageCardView, left: 20, right: 20)
} }
private func prepareImageCardViewWithoutDetailLabelAndDividerExample() { private func prepareImageCardViewWithoutDetailLabelAndDividerExample() {
...@@ -132,10 +132,10 @@ class ViewController: UIViewController { ...@@ -132,10 +132,10 @@ class ViewController: UIViewController {
// Add buttons to right side. // Add buttons to right side.
imageCardView.rightButtons = [btn1, btn2, btn3] imageCardView.rightButtons = [btn1, btn2, btn3]
// To support orientation changes, use MaterialLayout. // To support orientation changes, use Layout.
view.addSubview(imageCardView) view.addSubview(imageCardView)
MaterialLayout.alignFromTop(view, child: imageCardView, top: 100) Layout.alignFromTop(view, child: imageCardView, top: 100)
MaterialLayout.alignToParentHorizontally(view, child: imageCardView, left: 20, right: 20) Layout.alignToParentHorizontally(view, child: imageCardView, left: 20, right: 20)
} }
} }
...@@ -86,7 +86,7 @@ class ViewController: UIViewController { ...@@ -86,7 +86,7 @@ class ViewController: UIViewController {
collectionView.spacing = 16 collectionView.spacing = 16
view.addSubview(collectionView) view.addSubview(collectionView)
MaterialLayout.alignToParent(view, child: collectionView) Layout.alignToParent(view, child: collectionView)
} }
} }
......
...@@ -68,14 +68,14 @@ class ViewController: UIViewController { ...@@ -68,14 +68,14 @@ class ViewController: UIViewController {
let children: Array<UIView> = [v1, v2, v3, v4, v5] let children: Array<UIView> = [v1, v2, v3, v4, v5]
// Align the vs vertically with an equal height. // Align the vs vertically with an equal height.
MaterialLayout.alignToParentVertically(view, children: children, top: 100, bottom: 100, spacing: 20) Layout.alignToParentVertically(view, children: children, top: 100, bottom: 100, spacing: 20)
/* /*
Individually set the vs' horizontal alignment. Individually set the vs' horizontal alignment.
If this is left out, the intrinsic value is used for the view. If this is left out, the intrinsic value is used for the view.
*/ */
for v in children { for v in children {
MaterialLayout.alignToParentHorizontally(view, child: v, left: 20, right: 20) Layout.alignToParentHorizontally(view, child: v, left: 20, right: 20)
} }
} }
} }
......
...@@ -115,7 +115,7 @@ class ViewController: UIViewController { ...@@ -115,7 +115,7 @@ class ViewController: UIViewController {
view.addSubview(tableView) view.addSubview(tableView)
MaterialLayout.alignToParent(view, child: tableView, top: 20, left: 0, bottom: 0, right: 0) Layout.alignToParent(view, child: tableView, top: 20, left: 0, bottom: 0, right: 0)
} }
private func image(iconName:String!) -> UIImage? { private func image(iconName:String!) -> UIImage? {
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UISupportedInterfaceOrientations~ipad</key> <key>UISupportedInterfaceOrientations~ipad</key>
<array> <array>
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
*/ */
/** /**
MaterialLayout is an excellent tool to ease the use of AutoLayout. The following Layout is an excellent tool to ease the use of AutoLayout. The following
examples demonstrate laying out a collection of UILabel objects, both vertically examples demonstrate laying out a collection of UILabel objects, both vertically
and horizontally. and horizontally.
*/ */
...@@ -41,8 +41,8 @@ class ViewController: UIViewController { ...@@ -41,8 +41,8 @@ class ViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareAlignToParentHorizontallyExample() // prepareAlignToParentHorizontallyExample()
prepareAlignToParentVerticallyExample() // prepareAlignToParentVerticallyExample()
prepareCenterExample() prepareCenterExample()
} }
...@@ -57,38 +57,29 @@ class ViewController: UIViewController { ...@@ -57,38 +57,29 @@ class ViewController: UIViewController {
label1.backgroundColor = MaterialColor.red.base label1.backgroundColor = MaterialColor.red.base
label1.text = "A" label1.text = "A"
label1.textAlignment = .Center label1.textAlignment = .Center
view.addSubview(label1)
let label2: UILabel = UILabel() let label2: UILabel = UILabel()
label2.backgroundColor = MaterialColor.green.base label2.backgroundColor = MaterialColor.green.base
label2.text = "B" label2.text = "B"
label2.textAlignment = .Center label2.textAlignment = .Center
view.addSubview(label2)
let label3: UILabel = UILabel() let label3: UILabel = UILabel()
label3.backgroundColor = MaterialColor.blue.base label3.backgroundColor = MaterialColor.blue.base
label3.text = "C" label3.text = "C"
label3.textAlignment = .Center label3.textAlignment = .Center
view.addSubview(label3)
let label4: UILabel = UILabel() let label4: UILabel = UILabel()
label4.backgroundColor = MaterialColor.yellow.base label4.backgroundColor = MaterialColor.yellow.base
label4.text = "D" label4.text = "D"
label4.textAlignment = .Center label4.textAlignment = .Center
view.addSubview(label4)
let children: Array<UIView> = [label1, label2, label3, label4] let children: Array<UIView> = [label1, label2, label3, label4]
// Align the labels horizontally with an equal width. // Align the labels vertically with an equal height.
MaterialLayout.alignToParentHorizontally(view, children: children, left: 30, right: 30, spacing: 30) view.layout.vertically(children, top: 100, bottom: 100)
/* // Align the labels horizontally with an equal width.
Individually set the labels' vertical alignment. view.layout.horizontally(children, left: 30, right: 30, spacing: 30)
If this is left out, the intrinsic value is used for the view.
*/
for v in children {
MaterialLayout.alignToParentVertically(view, child: v, top: 100, bottom: 100)
}
// Print out the dimensions of the labels. // Print out the dimensions of the labels.
for v in children { for v in children {
...@@ -103,38 +94,29 @@ class ViewController: UIViewController { ...@@ -103,38 +94,29 @@ class ViewController: UIViewController {
label1.backgroundColor = MaterialColor.red.base label1.backgroundColor = MaterialColor.red.base
label1.text = "A" label1.text = "A"
label1.textAlignment = .Center label1.textAlignment = .Center
view.addSubview(label1)
let label2: UILabel = UILabel() let label2: UILabel = UILabel()
label2.backgroundColor = MaterialColor.green.base label2.backgroundColor = MaterialColor.green.base
label2.text = "B" label2.text = "B"
label2.textAlignment = .Center label2.textAlignment = .Center
view.addSubview(label2)
let label3: UILabel = UILabel() let label3: UILabel = UILabel()
label3.backgroundColor = MaterialColor.blue.base label3.backgroundColor = MaterialColor.blue.base
label3.text = "C" label3.text = "C"
label3.textAlignment = .Center label3.textAlignment = .Center
view.addSubview(label3)
let label4: UILabel = UILabel() let label4: UILabel = UILabel()
label4.backgroundColor = MaterialColor.yellow.base label4.backgroundColor = MaterialColor.yellow.base
label4.text = "D" label4.text = "D"
label4.textAlignment = .Center label4.textAlignment = .Center
view.addSubview(label4)
let children: Array<UIView> = [label1, label2, label3, label4] let children: Array<UIView> = [label1, label2, label3, label4]
// Align the labels vertically with an equal height. // Align the labels vertically with an equal height.
MaterialLayout.alignToParentVertically(view, children: children, top: 100, bottom: 100, spacing: 100) view.layout.vertically(children, top: 100, bottom: 100, spacing: 10)
/* // Align the labels horizontally with an equal width.
Individually set the labels' horizontal alignment. view.layout.horizontally(children, left: 100, right: 100)
If this is left out, the intrinsic value is used for the view.
*/
for v in children {
MaterialLayout.alignToParentHorizontally(view, child: v, left: 100, right: 100)
}
// Print out the dimensions of the labels. // Print out the dimensions of the labels.
for v in children { for v in children {
...@@ -145,7 +127,6 @@ class ViewController: UIViewController { ...@@ -145,7 +127,6 @@ class ViewController: UIViewController {
// Lays out test views to the center of different axes // Lays out test views to the center of different axes
private func prepareCenterExample() { private func prepareCenterExample() {
let length: CGFloat = 100 let length: CGFloat = 100
let labelCX = UILabel() let labelCX = UILabel()
...@@ -154,11 +135,9 @@ class ViewController: UIViewController { ...@@ -154,11 +135,9 @@ class ViewController: UIViewController {
labelCX.textAlignment = .Center labelCX.textAlignment = .Center
labelCX.layer.cornerRadius = length / 2.0 labelCX.layer.cornerRadius = length / 2.0
labelCX.clipsToBounds = true labelCX.clipsToBounds = true
view.addSubview(labelCX)
view.layout.size(labelCX, width: length, height: length)
MaterialLayout.width(view, child: labelCX, width: length) view.layout.centerHorizontally(labelCX)
MaterialLayout.height(view, child: labelCX, height: length)
MaterialLayout.centerHorizontally(view, child: labelCX)
let labelCY = UILabel() let labelCY = UILabel()
labelCY.backgroundColor = MaterialColor.grey.base labelCY.backgroundColor = MaterialColor.grey.base
...@@ -166,25 +145,19 @@ class ViewController: UIViewController { ...@@ -166,25 +145,19 @@ class ViewController: UIViewController {
labelCY.textAlignment = .Center labelCY.textAlignment = .Center
labelCY.layer.cornerRadius = length / 2.0 labelCY.layer.cornerRadius = length / 2.0
labelCY.clipsToBounds = true labelCY.clipsToBounds = true
view.addSubview(labelCY)
view.layout.size(labelCY, width: length, height: length)
MaterialLayout.width(view, child: labelCY, width: length) view.layout.centerVertically(labelCY)
MaterialLayout.height(view, child: labelCY, height: length)
MaterialLayout.centerVertically(view, child: labelCY)
let labelCXY = UILabel() let labelCXY = UILabel()
labelCXY.backgroundColor = MaterialColor.grey.base labelCXY.backgroundColor = MaterialColor.grey.base
labelCXY.text = "centerXY" labelCXY.text = "centerXY"
labelCXY.textAlignment = .Center labelCXY.textAlignment = .Center
labelCXY.layer.cornerRadius = length / 2.0 labelCXY.layer.cornerRadius = length / 2.0
labelCXY.clipsToBounds = true labelCXY.clipsToBounds = true
view.addSubview(labelCXY)
view.layout.size(labelCXY, width: length, height: length)
MaterialLayout.width(view, child: labelCXY, width: length) view.layout.center(labelCXY)
MaterialLayout.height(view, child: labelCXY, height: length)
MaterialLayout.center(view, child: labelCXY)
} }
} }
...@@ -55,9 +55,9 @@ class ViewController: UIViewController, MaterialSwitchDelegate { ...@@ -55,9 +55,9 @@ class ViewController: UIViewController, MaterialSwitchDelegate {
view.addSubview(bottomView) view.addSubview(bottomView)
bottomView.backgroundColor = MaterialColor.grey.darken4 bottomView.backgroundColor = MaterialColor.grey.darken4
MaterialLayout.alignToParentHorizontally(view, child: topView) Layout.alignToParentHorizontally(view, child: topView)
MaterialLayout.alignToParentHorizontally(view, child: bottomView) Layout.alignToParentHorizontally(view, child: bottomView)
MaterialLayout.alignToParentVertically(view, children: [topView, bottomView]) Layout.alignToParentVertically(view, children: [topView, bottomView])
} }
/// Prepares the LightContent MaterialSwitch. /// Prepares the LightContent MaterialSwitch.
...@@ -75,10 +75,10 @@ class ViewController: UIViewController, MaterialSwitchDelegate { ...@@ -75,10 +75,10 @@ class ViewController: UIViewController, MaterialSwitchDelegate {
c3.enabled = false c3.enabled = false
topView.addSubview(c3) topView.addSubview(c3)
MaterialLayout.alignToParentHorizontally(topView, child: c1) Layout.alignToParentHorizontally(topView, child: c1)
MaterialLayout.alignToParentHorizontally(topView, child: c2) Layout.alignToParentHorizontally(topView, child: c2)
MaterialLayout.alignToParentHorizontally(topView, child: c3) Layout.alignToParentHorizontally(topView, child: c3)
MaterialLayout.alignToParentVertically(topView, children: [c1, c2, c3]) Layout.alignToParentVertically(topView, children: [c1, c2, c3])
} }
/// Prepares the LightContent MaterialSwitch. /// Prepares the LightContent MaterialSwitch.
...@@ -96,10 +96,10 @@ class ViewController: UIViewController, MaterialSwitchDelegate { ...@@ -96,10 +96,10 @@ class ViewController: UIViewController, MaterialSwitchDelegate {
c3.enabled = false c3.enabled = false
bottomView.addSubview(c3) bottomView.addSubview(c3)
MaterialLayout.alignToParentHorizontally(bottomView, child: c1) Layout.alignToParentHorizontally(bottomView, child: c1)
MaterialLayout.alignToParentHorizontally(bottomView, child: c2) Layout.alignToParentHorizontally(bottomView, child: c2)
MaterialLayout.alignToParentHorizontally(bottomView, child: c3) Layout.alignToParentHorizontally(bottomView, child: c3)
MaterialLayout.alignToParentVertically(bottomView, children: [c1, c2, c3]) Layout.alignToParentVertically(bottomView, children: [c1, c2, c3])
} }
internal func materialSwitchStateChanged(control: MaterialSwitch) { internal func materialSwitchStateChanged(control: MaterialSwitch) {
......
...@@ -149,8 +149,8 @@ class AppMenuController: MenuController { ...@@ -149,8 +149,8 @@ class AppMenuController: MenuController {
menuView.delegate = self menuView.delegate = self
view.addSubview(menuView) view.addSubview(menuView)
MaterialLayout.size(view, child: menuView, width: baseSize.width, height: baseSize.height) Layout.size(view, child: menuView, width: baseSize.width, height: baseSize.height)
MaterialLayout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset) Layout.alignFromBottomRight(view, child: menuView, bottom: menuViewInset, right: menuViewInset)
} }
} }
......
...@@ -138,8 +138,8 @@ class ViewController: UIViewController { ...@@ -138,8 +138,8 @@ class ViewController: UIViewController {
menuView.menu.views = [btn1, btn2, btn3, btn4] menuView.menu.views = [btn1, btn2, btn3, btn4]
view.addSubview(menuView) view.addSubview(menuView)
MaterialLayout.size(view, child: menuView, width: diameter, height: diameter) Layout.size(view, child: menuView, width: diameter, height: diameter)
MaterialLayout.alignFromBottomLeft(view, child: menuView, bottom: 16, left: (view.bounds.width - diameter) / 2) Layout.alignFromBottomLeft(view, child: menuView, bottom: 16, left: (view.bounds.width - diameter) / 2)
} }
} }
...@@ -61,7 +61,7 @@ class ViewController: UIViewController { ...@@ -61,7 +61,7 @@ class ViewController: UIViewController {
containerView = UIView() containerView = UIView()
view.addSubview(containerView) view.addSubview(containerView)
MaterialLayout.alignToParent(view, child: containerView, top: 100, left: 20, right: 20) Layout.alignToParent(view, child: containerView, top: 100, left: 20, right: 20)
} }
/// Prepares the toolbar /// Prepares the toolbar
......
...@@ -74,9 +74,9 @@ class AppLeftViewController: UIViewController { ...@@ -74,9 +74,9 @@ class AppLeftViewController: UIViewController {
tableView.delegate = self tableView.delegate = self
tableView.separatorStyle = .None tableView.separatorStyle = .None
// Use MaterialLayout to easily align the tableView. // Use Layout to easily align the tableView.
view.addSubview(tableView) view.addSubview(tableView)
MaterialLayout.alignToParent(view, child: tableView) Layout.alignToParent(view, child: tableView)
} }
} }
......
...@@ -111,14 +111,14 @@ class ViewController: UIViewController { ...@@ -111,14 +111,14 @@ class ViewController: UIViewController {
settingButton.setImage(image, forState: .Normal) settingButton.setImage(image, forState: .Normal)
settingButton.setImage(image, forState: .Highlighted) settingButton.setImage(image, forState: .Highlighted)
// Use MaterialLayout to easily align the tableView. // Use Layout to easily align the tableView.
cardView.titleLabel = titleLabel cardView.titleLabel = titleLabel
cardView.contentView = tableView cardView.contentView = tableView
cardView.leftButtons = [closeButton] cardView.leftButtons = [closeButton]
cardView.rightButtons = [settingButton] cardView.rightButtons = [settingButton]
view.addSubview(cardView) view.addSubview(cardView)
MaterialLayout.alignToParent(view, child: cardView, left: 10, right: 10, top: 100, bottom: 100) Layout.alignToParent(view, child: cardView, left: 10, right: 10, top: 100, bottom: 100)
} }
} }
......
...@@ -71,8 +71,8 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -71,8 +71,8 @@ class ViewController: UIViewController, TextFieldDelegate {
btn.setTitleColor(MaterialColor.blue.base, forState: .Highlighted) btn.setTitleColor(MaterialColor.blue.base, forState: .Highlighted)
view.addSubview(btn) view.addSubview(btn)
MaterialLayout.alignFromBottomRight(view, child: btn, bottom: 24, right: 24) Layout.alignFromBottomRight(view, child: btn, bottom: 24, right: 24)
MaterialLayout.size(view, child: btn, width: 100, height: 50) Layout.size(view, child: btn, width: 100, height: 50)
} }
/// Handle the resign responder button. /// Handle the resign responder button.
...@@ -96,8 +96,8 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -96,8 +96,8 @@ class ViewController: UIViewController, TextFieldDelegate {
// Size the TextField to the maximum width, less 40 pixels on either side // Size the TextField to the maximum width, less 40 pixels on either side
// with a top margin of 40 pixels. // with a top margin of 40 pixels.
MaterialLayout.alignFromTop(view, child: nameField, top: 40) Layout.alignFromTop(view, child: nameField, top: 40)
MaterialLayout.alignToParentHorizontally(view, child: nameField, left: 40, right: 40) Layout.alignToParentHorizontally(view, child: nameField, left: 40, right: 40)
} }
/// Prepares the email TextField. /// Prepares the email TextField.
...@@ -130,8 +130,8 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -130,8 +130,8 @@ class ViewController: UIViewController, TextFieldDelegate {
// Size the TextField to the maximum width, less 40 pixels on either side // Size the TextField to the maximum width, less 40 pixels on either side
// with a top margin of 200 pixels. // with a top margin of 200 pixels.
MaterialLayout.alignFromTop(view, child: passwordField, top: 200) Layout.alignFromTop(view, child: passwordField, top: 200)
MaterialLayout.alignToParentHorizontally(view, child: passwordField, left: 40, right: 40) Layout.alignToParentHorizontally(view, child: passwordField, left: 40, right: 40)
} }
/// Executed when the 'return' key is pressed when using the emailField. /// Executed when the 'return' key is pressed when using the emailField.
......
...@@ -76,7 +76,7 @@ class ViewController: UIViewController, TextDelegate { ...@@ -76,7 +76,7 @@ class ViewController: UIViewController, TextDelegate {
textView.titleLabelActiveColor = MaterialColor.blue.accent3 textView.titleLabelActiveColor = MaterialColor.blue.accent3
view.addSubview(textView) view.addSubview(textView)
MaterialLayout.alignToParent(view, child: textView!, top: 124, left: 24, bottom: 24, right: 24) Layout.alignToParent(view, child: textView!, top: 124, left: 24, bottom: 24, right: 24)
} }
/** /**
......
...@@ -61,7 +61,7 @@ class ViewController: UIViewController { ...@@ -61,7 +61,7 @@ class ViewController: UIViewController {
containerView = UIView() containerView = UIView()
view.addSubview(containerView) view.addSubview(containerView)
MaterialLayout.alignToParent(view, child: containerView, top: 100, left: 20, right: 20) Layout.alignToParent(view, child: containerView, top: 100, left: 20, right: 20)
} }
/// Prepares the toolbar /// Prepares the toolbar
......
...@@ -44,8 +44,8 @@ class RootViewController: UIViewController { ...@@ -44,8 +44,8 @@ class RootViewController: UIViewController {
fabButton.addTarget(self, action: #selector(handleFabButton), forControlEvents: .TouchUpInside) fabButton.addTarget(self, action: #selector(handleFabButton), forControlEvents: .TouchUpInside)
view.addSubview(fabButton) view.addSubview(fabButton)
MaterialLayout.alignFromBottomRight(view, child: fabButton, bottom: 16, right: 16) Layout.alignFromBottomRight(view, child: fabButton, bottom: 16, right: 16)
MaterialLayout.size(view, child: fabButton, width: 64, height: 64) Layout.size(view, child: fabButton, width: 64, height: 64)
} }
// FabButton handler. // FabButton handler.
......
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
96BCB7C71CB40DC500C806FE /* MaterialKeyframeAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77E1CB40DC500C806FE /* MaterialKeyframeAnimation.swift */; }; 96BCB7C71CB40DC500C806FE /* MaterialKeyframeAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77E1CB40DC500C806FE /* MaterialKeyframeAnimation.swift */; };
96BCB7C81CB40DC500C806FE /* MaterialLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77F1CB40DC500C806FE /* MaterialLabel.swift */; }; 96BCB7C81CB40DC500C806FE /* MaterialLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB77F1CB40DC500C806FE /* MaterialLabel.swift */; };
96BCB7C91CB40DC500C806FE /* MaterialLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7801CB40DC500C806FE /* MaterialLayer.swift */; }; 96BCB7C91CB40DC500C806FE /* MaterialLayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7801CB40DC500C806FE /* MaterialLayer.swift */; };
96BCB7CA1CB40DC500C806FE /* MaterialLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7811CB40DC500C806FE /* MaterialLayout.swift */; }; 96BCB7CA1CB40DC500C806FE /* Layout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7811CB40DC500C806FE /* Layout.swift */; };
96BCB7CB1CB40DC500C806FE /* MaterialPulseAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7821CB40DC500C806FE /* MaterialPulseAnimation.swift */; }; 96BCB7CB1CB40DC500C806FE /* MaterialPulseAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7821CB40DC500C806FE /* MaterialPulseAnimation.swift */; };
96BCB7CD1CB40DC500C806FE /* MaterialPulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7841CB40DC500C806FE /* MaterialPulseView.swift */; }; 96BCB7CD1CB40DC500C806FE /* MaterialPulseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7841CB40DC500C806FE /* MaterialPulseView.swift */; };
96BCB7CE1CB40DC500C806FE /* MaterialRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7851CB40DC500C806FE /* MaterialRadius.swift */; }; 96BCB7CE1CB40DC500C806FE /* MaterialRadius.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7851CB40DC500C806FE /* MaterialRadius.swift */; };
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
96BCB8341CB4115200C806FE /* MaterialLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7801CB40DC500C806FE /* MaterialLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8341CB4115200C806FE /* MaterialLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7801CB40DC500C806FE /* MaterialLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8351CB4115200C806FE /* MaterialTextLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78A1CB40DC500C806FE /* MaterialTextLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8351CB4115200C806FE /* MaterialTextLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78A1CB40DC500C806FE /* MaterialTextLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8361CB4115200C806FE /* Grid.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7611CB40DC500C806FE /* Grid.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8361CB4115200C806FE /* Grid.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7611CB40DC500C806FE /* Grid.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8371CB4115200C806FE /* MaterialLayout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7811CB40DC500C806FE /* MaterialLayout.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8371CB4115200C806FE /* Layout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7811CB40DC500C806FE /* Layout.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8381CB4115200C806FE /* ControlView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB75E1CB40DC500C806FE /* ControlView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8381CB4115200C806FE /* ControlView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB75E1CB40DC500C806FE /* ControlView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7951CB40DC500C806FE /* SearchBar.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7951CB40DC500C806FE /* SearchBar.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7961CB40DC500C806FE /* SearchBarController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7961CB40DC500C806FE /* SearchBarController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
96BCB77E1CB40DC500C806FE /* MaterialKeyframeAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialKeyframeAnimation.swift; sourceTree = "<group>"; }; 96BCB77E1CB40DC500C806FE /* MaterialKeyframeAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialKeyframeAnimation.swift; sourceTree = "<group>"; };
96BCB77F1CB40DC500C806FE /* MaterialLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLabel.swift; sourceTree = "<group>"; }; 96BCB77F1CB40DC500C806FE /* MaterialLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLabel.swift; sourceTree = "<group>"; };
96BCB7801CB40DC500C806FE /* MaterialLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLayer.swift; sourceTree = "<group>"; }; 96BCB7801CB40DC500C806FE /* MaterialLayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLayer.swift; sourceTree = "<group>"; };
96BCB7811CB40DC500C806FE /* MaterialLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialLayout.swift; sourceTree = "<group>"; }; 96BCB7811CB40DC500C806FE /* Layout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Layout.swift; sourceTree = "<group>"; };
96BCB7821CB40DC500C806FE /* MaterialPulseAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseAnimation.swift; sourceTree = "<group>"; }; 96BCB7821CB40DC500C806FE /* MaterialPulseAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseAnimation.swift; sourceTree = "<group>"; };
96BCB7841CB40DC500C806FE /* MaterialPulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseView.swift; sourceTree = "<group>"; }; 96BCB7841CB40DC500C806FE /* MaterialPulseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialPulseView.swift; sourceTree = "<group>"; };
96BCB7851CB40DC500C806FE /* MaterialRadius.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialRadius.swift; sourceTree = "<group>"; }; 96BCB7851CB40DC500C806FE /* MaterialRadius.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MaterialRadius.swift; sourceTree = "<group>"; };
...@@ -480,7 +480,7 @@ ...@@ -480,7 +480,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96BCB7611CB40DC500C806FE /* Grid.swift */, 96BCB7611CB40DC500C806FE /* Grid.swift */,
96BCB7811CB40DC500C806FE /* MaterialLayout.swift */, 96BCB7811CB40DC500C806FE /* Layout.swift */,
); );
name = Layout; name = Layout;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -670,7 +670,7 @@ ...@@ -670,7 +670,7 @@
96BCB8341CB4115200C806FE /* MaterialLayer.swift in Headers */, 96BCB8341CB4115200C806FE /* MaterialLayer.swift in Headers */,
96BCB8351CB4115200C806FE /* MaterialTextLayer.swift in Headers */, 96BCB8351CB4115200C806FE /* MaterialTextLayer.swift in Headers */,
96BCB8361CB4115200C806FE /* Grid.swift in Headers */, 96BCB8361CB4115200C806FE /* Grid.swift in Headers */,
96BCB8371CB4115200C806FE /* MaterialLayout.swift in Headers */, 96BCB8371CB4115200C806FE /* Layout.swift in Headers */,
96BCB8381CB4115200C806FE /* ControlView.swift in Headers */, 96BCB8381CB4115200C806FE /* ControlView.swift in Headers */,
96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */, 96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */,
96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */, 96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */,
...@@ -896,7 +896,7 @@ ...@@ -896,7 +896,7 @@
96BCB7E61CB40DC500C806FE /* TextStorage.swift in Sources */, 96BCB7E61CB40DC500C806FE /* TextStorage.swift in Sources */,
96BCB7B21CB40DC500C806FE /* Material+UIImage+Network.swift in Sources */, 96BCB7B21CB40DC500C806FE /* Material+UIImage+Network.swift in Sources */,
96BCB7A91CB40DC500C806FE /* FlatButton.swift in Sources */, 96BCB7A91CB40DC500C806FE /* FlatButton.swift in Sources */,
96BCB7CA1CB40DC500C806FE /* MaterialLayout.swift in Sources */, 96BCB7CA1CB40DC500C806FE /* Layout.swift in Sources */,
96BCB7D11CB40DC500C806FE /* MaterialSwitch.swift in Sources */, 96BCB7D11CB40DC500C806FE /* MaterialSwitch.swift in Sources */,
96BCB7BA1CB40DC500C806FE /* MaterialCollectionView.swift in Sources */, 96BCB7BA1CB40DC500C806FE /* MaterialCollectionView.swift in Sources */,
96BCB7A31CB40DC500C806FE /* CapturePreview.swift in Sources */, 96BCB7A31CB40DC500C806FE /* CapturePreview.swift in Sources */,
......
...@@ -233,8 +233,8 @@ public class BottomTabBar : UITabBar { ...@@ -233,8 +233,8 @@ public class BottomTabBar : UITabBar {
super.didMoveToSuperview() super.didMoveToSuperview()
if autoLayoutToSuperview { if autoLayoutToSuperview {
if let v: UIView = superview { if let v: UIView = superview {
MaterialLayout.alignFromBottom(v, child: self) Layout.alignFromBottom(v, child: self)
MaterialLayout.alignToParentHorizontally(v, child: self) Layout.alignToParentHorizontally(v, child: self)
} }
} }
} }
......
...@@ -279,7 +279,7 @@ public class CardView : MaterialPulseView { ...@@ -279,7 +279,7 @@ public class CardView : MaterialPulseView {
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
views["titleLabel"] = v views["titleLabel"] = v
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right) Layout.alignToParentHorizontally(self, child: v, left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right)
} }
// detail // detail
...@@ -296,7 +296,7 @@ public class CardView : MaterialPulseView { ...@@ -296,7 +296,7 @@ public class CardView : MaterialPulseView {
verticalFormat += "-[contentView]" verticalFormat += "-[contentView]"
views["contentView"] = v views["contentView"] = v
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right) Layout.alignToParentHorizontally(self, child: v, left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right)
} }
// leftButtons // leftButtons
...@@ -319,12 +319,12 @@ public class CardView : MaterialPulseView { ...@@ -319,12 +319,12 @@ public class CardView : MaterialPulseView {
h += "[\(k)]" h += "[\(k)]"
addSubview(b) addSubview(b)
MaterialLayout.alignFromBottom(self, child: b, bottom: contentInset.bottom + leftButtonsInset.bottom) Layout.alignFromBottom(self, child: b, bottom: contentInset.bottom + leftButtonsInset.bottom)
i += 1 i += 1
} }
addConstraints(MaterialLayout.constraint(h, options: [], metrics: ["left" : contentInset.left + leftButtonsInset.left, "left_right" : leftButtonsInset.left + leftButtonsInset.right], views: d)) addConstraints(Layout.constraint(h, options: [], metrics: ["left" : contentInset.left + leftButtonsInset.left, "left_right" : leftButtonsInset.left + leftButtonsInset.right], views: d))
} }
} }
...@@ -349,12 +349,12 @@ public class CardView : MaterialPulseView { ...@@ -349,12 +349,12 @@ public class CardView : MaterialPulseView {
} }
addSubview(b) addSubview(b)
MaterialLayout.alignFromBottom(self, child: b, bottom: contentInset.bottom + rightButtonsInset.bottom) Layout.alignFromBottom(self, child: b, bottom: contentInset.bottom + rightButtonsInset.bottom)
i -= 1 i -= 1
} }
addConstraints(MaterialLayout.constraint(h + "|", options: [], metrics: ["right" : contentInset.right + rightButtonsInset.right, "right_left" : rightButtonsInset.right + rightButtonsInset.left], views: d)) addConstraints(Layout.constraint(h + "|", options: [], metrics: ["right" : contentInset.right + rightButtonsInset.right, "right_left" : rightButtonsInset.right + rightButtonsInset.left], views: d))
} }
} }
...@@ -388,7 +388,7 @@ public class CardView : MaterialPulseView { ...@@ -388,7 +388,7 @@ public class CardView : MaterialPulseView {
if 0 < views.count { if 0 < views.count {
verticalFormat += "-(insetBottom)-|" verticalFormat += "-(insetBottom)-|"
addConstraints(MaterialLayout.constraint(verticalFormat, options: [], metrics: metrics, views: views)) addConstraints(Layout.constraint(verticalFormat, options: [], metrics: metrics, views: views))
} }
} }
......
...@@ -380,9 +380,9 @@ public class ImageCardView : MaterialPulseView { ...@@ -380,9 +380,9 @@ public class ImageCardView : MaterialPulseView {
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
views["titleLabel"] = v views["titleLabel"] = v
} else { } else {
MaterialLayout.alignFromTop(self, child: v, top: contentInset.top + titleLabelInset.top) Layout.alignFromTop(self, child: v, top: contentInset.top + titleLabelInset.top)
} }
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right) Layout.alignToParentHorizontally(self, child: v, left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right)
} }
// detail // detail
...@@ -399,7 +399,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -399,7 +399,7 @@ public class ImageCardView : MaterialPulseView {
verticalFormat += "-[contentView]" verticalFormat += "-[contentView]"
views["contentView"] = v views["contentView"] = v
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right) Layout.alignToParentHorizontally(self, child: v, left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right)
} }
// leftButtons // leftButtons
...@@ -422,12 +422,12 @@ public class ImageCardView : MaterialPulseView { ...@@ -422,12 +422,12 @@ public class ImageCardView : MaterialPulseView {
h += "[\(k)]" h += "[\(k)]"
addSubview(b) addSubview(b)
MaterialLayout.alignFromBottom(self, child: b, bottom: contentInset.bottom + leftButtonsInset.bottom) Layout.alignFromBottom(self, child: b, bottom: contentInset.bottom + leftButtonsInset.bottom)
i += 1 i += 1
} }
addConstraints(MaterialLayout.constraint(h, options: [], metrics: ["left" : contentInset.left + leftButtonsInset.left, "left_right" : leftButtonsInset.left + leftButtonsInset.right], views: d)) addConstraints(Layout.constraint(h, options: [], metrics: ["left" : contentInset.left + leftButtonsInset.left, "left_right" : leftButtonsInset.left + leftButtonsInset.right], views: d))
} }
} }
...@@ -452,12 +452,12 @@ public class ImageCardView : MaterialPulseView { ...@@ -452,12 +452,12 @@ public class ImageCardView : MaterialPulseView {
} }
addSubview(b) addSubview(b)
MaterialLayout.alignFromBottom(self, child: b, bottom: contentInset.bottom + rightButtonsInset.bottom) Layout.alignFromBottom(self, child: b, bottom: contentInset.bottom + rightButtonsInset.bottom)
i -= 1 i -= 1
} }
addConstraints(MaterialLayout.constraint(h + "|", options: [], metrics: ["right" : contentInset.right + rightButtonsInset.right, "right_left" : rightButtonsInset.right + rightButtonsInset.left], views: d)) addConstraints(Layout.constraint(h + "|", options: [], metrics: ["right" : contentInset.right + rightButtonsInset.right, "right_left" : rightButtonsInset.right + rightButtonsInset.left], views: d))
} }
} }
...@@ -520,7 +520,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -520,7 +520,7 @@ public class ImageCardView : MaterialPulseView {
metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom
} else { } else {
if translatesAutoresizingMaskIntoConstraints { if translatesAutoresizingMaskIntoConstraints {
addConstraints(MaterialLayout.constraint("V:[view(height)]", options: [], metrics: ["height": imageLayer!.frame.height], views: ["view": self])) addConstraints(Layout.constraint("V:[view(height)]", options: [], metrics: ["height": imageLayer!.frame.height], views: ["view": self]))
} else { } else {
height = imageLayer!.frame.height height = imageLayer!.frame.height
} }
...@@ -529,7 +529,7 @@ public class ImageCardView : MaterialPulseView { ...@@ -529,7 +529,7 @@ public class ImageCardView : MaterialPulseView {
if 0 < views.count { if 0 < views.count {
verticalFormat += "-(insetBottom)-|" verticalFormat += "-(insetBottom)-|"
addConstraints(MaterialLayout.constraint(verticalFormat, options: [], metrics: metrics, views: views)) addConstraints(Layout.constraint(verticalFormat, options: [], metrics: metrics, views: views))
} }
} }
......
...@@ -433,6 +433,7 @@ public class NavigationBar : UINavigationBar { ...@@ -433,6 +433,7 @@ public class NavigationBar : UINavigationBar {
let image: UIImage? = UIImage.imageWithColor(MaterialColor.clear, size: CGSizeMake(1, 1)) let image: UIImage? = UIImage.imageWithColor(MaterialColor.clear, size: CGSizeMake(1, 1))
shadowImage = image shadowImage = image
setBackgroundImage(image, forBarMetrics: .Default) setBackgroundImage(image, forBarMetrics: .Default)
backgroundColor = MaterialColor.white
} }
/** /**
......
...@@ -409,7 +409,7 @@ public class TextView: UITextView { ...@@ -409,7 +409,7 @@ public class TextView: UITextView {
internal func reloadView() { internal func reloadView() {
if let p = placeholderLabel { if let p = placeholderLabel {
removeConstraints(constraints) removeConstraints(constraints)
MaterialLayout.alignToParent(self, Layout.alignToParent(self,
child: p, child: p,
top: textContainerInset.top, top: textContainerInset.top,
left: textContainerInset.left + textContainer.lineFragmentPadding, left: textContainerInset.left + textContainer.lineFragmentPadding,
......
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