Commit c1f56440 by Daniel Dahan

ready for testing for release 1.41.3

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