Commit c1f56440 by Daniel Dahan

ready for testing for release 1.41.3

parent cbbcbe5e
...@@ -121,10 +121,12 @@ class ItemViewController: UIViewController { ...@@ -121,10 +121,12 @@ class ItemViewController: UIViewController {
/// Prepares the navigationItem. /// Prepares the navigationItem.
private func prepareNavigationItem() { private func prepareNavigationItem() {
navigationItem.titleLabel.text = "Item" navigationItem.title = "Item"
navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.textColor = MaterialColor.white navigationItem.titleLabel.textColor = MaterialColor.white
navigationItem.detailLabel.text = "January 22, 2016" navigationItem.detail = "January 22, 2016"
navigationItem.detailLabel.textAlignment = .Left
navigationItem.detailLabel.textColor = MaterialColor.white navigationItem.detailLabel.textColor = MaterialColor.white
navigationItem.rightControls = [shareButton] navigationItem.rightControls = [shareButton]
......
...@@ -244,7 +244,8 @@ class RecipesViewController: UIViewController { ...@@ -244,7 +244,8 @@ class RecipesViewController: UIViewController {
/// Prepares the navigationItem. /// Prepares the navigationItem.
private func prepareNavigationItem() { private func prepareNavigationItem() {
navigationItem.titleLabel.text = "Recipes" navigationItem.title = "Recipes"
navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.textColor = MaterialColor.white navigationItem.titleLabel.textColor = MaterialColor.white
navigationItem.titleLabel.font = RobotoFont.mediumWithSize(20) navigationItem.titleLabel.font = RobotoFont.mediumWithSize(20)
......
...@@ -70,11 +70,11 @@ class ViewController: UIViewController { ...@@ -70,11 +70,11 @@ class ViewController: UIViewController {
containerView.addSubview(toolbar) containerView.addSubview(toolbar)
// Title label. // Title label.
toolbar.titleLabel.text = "Material" toolbar.title = "Material"
toolbar.titleLabel.textColor = MaterialColor.white toolbar.titleLabel.textColor = MaterialColor.white
// Detail label. // Detail label.
toolbar.detailLabel.text = "Build Beautiful Software" toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textColor = MaterialColor.white toolbar.detailLabel.textColor = MaterialColor.white
var image: UIImage? = MaterialIcon.cm.menu var image: UIImage? = MaterialIcon.cm.menu
......
...@@ -56,7 +56,7 @@ class AppToolbarController: ToolbarController { ...@@ -56,7 +56,7 @@ class AppToolbarController: ToolbarController {
/// Prepares the toolbar. /// Prepares the toolbar.
private func prepareToolbar() { private func prepareToolbar() {
// Title label. // Title label.
toolbar.titleLabel.text = "Material" toolbar.title = "Material"
toolbar.titleLabel.textColor = MaterialColor.white toolbar.titleLabel.textColor = MaterialColor.white
// Detail label. Uncomment the code below to use a detail label. // Detail label. Uncomment the code below to use a detail label.
...@@ -87,8 +87,8 @@ class AppToolbarController: ToolbarController { ...@@ -87,8 +87,8 @@ class AppToolbarController: ToolbarController {
searchButton.addTarget(self, action: #selector(handleSearchButton), forControlEvents: .TouchUpInside) searchButton.addTarget(self, action: #selector(handleSearchButton), forControlEvents: .TouchUpInside)
toolbar.statusBarStyle = .LightContent toolbar.statusBarStyle = .LightContent
toolbar.backgroundColor = MaterialColor.blue.base
toolbar.leftControls = [menuButton] toolbar.leftControls = [menuButton]
toolbar.rightControls = [switchControl, searchButton] toolbar.rightControls = [switchControl, searchButton]
toolbar.backgroundColor = MaterialColor.blue.base
} }
} }
...@@ -69,12 +69,12 @@ class ViewController: UIViewController { ...@@ -69,12 +69,12 @@ class ViewController: UIViewController {
toolbar.statusBarStyle = .LightContent toolbar.statusBarStyle = .LightContent
// Title label. // Title label.
toolbar.titleLabel.text = "Material" toolbar.title = "Material"
toolbar.titleLabel.textColor = MaterialColor.white toolbar.titleLabel.textColor = MaterialColor.white
// Detail label. // Detail label.
toolbar.detailLabel.text = "Build Beautiful Software" toolbar.detail = "Build Beautiful Software"
toolbar.detailLabel.textColor = MaterialColor.white toolbar.detailLabel.textColor = MaterialColor.white
// Menu button. // Menu button.
let img1: UIImage? = MaterialIcon.cm.menu let img1: UIImage? = MaterialIcon.cm.menu
......
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '1.41.2' s.version = '1.41.3'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'An animation and graphics framework for Material Design in Swift.' s.summary = 'An animation and graphics framework for Material Design in Swift.'
s.homepage = 'http://cosmicmind.io' s.homepage = 'http://cosmicmind.io'
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>FMWK</string> <string>FMWK</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.41.2</string> <string>1.41.3</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
......
...@@ -87,6 +87,14 @@ public class NavigationBar : UINavigationBar { ...@@ -87,6 +87,14 @@ public class NavigationBar : UINavigationBar {
} }
} }
/// Grid cell factor.
@IBInspectable public var gridFactor: CGFloat = 24 {
didSet {
assert(0 < gridFactor, "[Material Error: gridFactor must be greater than 0.]")
layoutSubviews()
}
}
/** /**
The back button image writes to the backIndicatorImage property and The back button image writes to the backIndicatorImage property and
backIndicatorTransitionMaskImage property. backIndicatorTransitionMaskImage property.
...@@ -318,8 +326,7 @@ public class NavigationBar : UINavigationBar { ...@@ -318,8 +326,7 @@ public class NavigationBar : UINavigationBar {
if let titleView: UIView = prepareTitleView(item) { if let titleView: UIView = prepareTitleView(item) {
if let contentView: UIView = prepareContentView(item) { if let contentView: UIView = prepareContentView(item) {
let factor: CGFloat = 24 if let g: Int = Int(width / gridFactor) {
if let g: Int = Int(width / factor) {
let columns: Int = g + 1 let columns: Int = g + 1
titleView.frame.origin = CGPointZero titleView.frame.origin = CGPointZero
...@@ -336,7 +343,7 @@ public class NavigationBar : UINavigationBar { ...@@ -336,7 +343,7 @@ public class NavigationBar : UINavigationBar {
(c as? UIButton)?.contentEdgeInsets = UIEdgeInsetsZero (c as? UIButton)?.contentEdgeInsets = UIEdgeInsetsZero
c.frame.size.height = titleView.frame.size.height - contentInset.top - contentInset.bottom c.frame.size.height = titleView.frame.size.height - contentInset.top - contentInset.bottom
let q: Int = Int(w / factor) let q: Int = Int(w / gridFactor)
c.grid.columns = q + 1 c.grid.columns = q + 1
contentView.grid.columns -= c.grid.columns contentView.grid.columns -= c.grid.columns
...@@ -356,7 +363,7 @@ public class NavigationBar : UINavigationBar { ...@@ -356,7 +363,7 @@ public class NavigationBar : UINavigationBar {
(c as? UIButton)?.contentEdgeInsets = UIEdgeInsetsZero (c as? UIButton)?.contentEdgeInsets = UIEdgeInsetsZero
c.frame.size.height = titleView.frame.size.height - contentInset.top - contentInset.bottom c.frame.size.height = titleView.frame.size.height - contentInset.top - contentInset.bottom
let q: Int = Int(w / factor) let q: Int = Int(w / gridFactor)
c.grid.columns = q + 1 c.grid.columns = q + 1
contentView.grid.columns -= c.grid.columns contentView.grid.columns -= c.grid.columns
...@@ -433,7 +440,15 @@ public class NavigationBar : UINavigationBar { ...@@ -433,7 +440,15 @@ public class NavigationBar : UINavigationBar {
- Parameter item: A UINavigationItem to layout. - Parameter item: A UINavigationItem to layout.
*/ */
private func prepareItem(item: UINavigationItem) { private func prepareItem(item: UINavigationItem) {
item.title = "" if let v: String = item.titleLabel.text {
if v != item.title {
item.title = v
}
} else {
item.titleLabel.text = item.title
}
item.hidesBackButton = true
item.setHidesBackButton(true, animated: false)
} }
/** /**
......
...@@ -128,7 +128,6 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD ...@@ -128,7 +128,6 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
} }
item.backButton = backButton item.backButton = backButton
item.hidesBackButton = true
v.layoutNavigationItem(item) v.layoutNavigationItem(item)
} }
return true return true
......
...@@ -43,9 +43,6 @@ public class MaterialAssociatedObjectNavigationItem { ...@@ -43,9 +43,6 @@ public class MaterialAssociatedObjectNavigationItem {
/// Title label. /// Title label.
public private(set) var titleLabel: UILabel! public private(set) var titleLabel: UILabel!
/// Detail text.
public var detail: String?
/// Detail label. /// Detail label.
public private(set) var detailLabel: UILabel! public private(set) var detailLabel: UILabel!
...@@ -122,10 +119,10 @@ public extension UINavigationItem { ...@@ -122,10 +119,10 @@ public extension UINavigationItem {
/// Detail text. /// Detail text.
public var detail: String? { public var detail: String? {
get { get {
return item.detail return detailLabel.text
} }
set(value) { set(value) {
item.detail = value detailLabel.text = value
} }
} }
......
...@@ -31,16 +31,38 @@ ...@@ -31,16 +31,38 @@
import UIKit import UIKit
public class Toolbar : BarView { public class Toolbar : BarView {
/// A convenience property to set the titleLabel text.
public var title: String? {
get {
return titleLabel?.text
}
set(value) {
titleLabel?.text = value
layoutSubviews()
}
}
/// Title label. /// Title label.
public private(set) var titleLabel: UILabel! public private(set) var titleLabel: UILabel!
/// A convenience property to set the detailLabel text.
public var detail: String? {
get {
return detailLabel?.text
}
set(value) {
detailLabel?.text = value
layoutSubviews()
}
}
/// Detail label. /// Detail label.
public private(set) var detailLabel: UILabel! public private(set) var detailLabel: UILabel!
public override func layoutSubviews() { public override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
if willRenderView { if willRenderView {
if let _: String = detailLabel.text { if let _: String = detail {
titleLabel.sizeToFit() titleLabel.sizeToFit()
detailLabel.sizeToFit() detailLabel.sizeToFit()
......
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