Commit fd0b041e by Daniel Dahan

development: updated Toolbar title and detail to be @IBInspectable

parent 8d997a6d
...@@ -33,7 +33,8 @@ import UIKit ...@@ -33,7 +33,8 @@ import UIKit
private var ToolbarContext: UInt8 = 0 private var ToolbarContext: UInt8 = 0
open class Toolbar: Bar { open class Toolbar: Bar {
/// A convenience property to set the titleLabel text. /// A convenience property to set the titleLabel.text.
@IBInspectable
open var title: String? { open var title: String? {
get { get {
return titleLabel.text return titleLabel.text
...@@ -45,9 +46,11 @@ open class Toolbar: Bar { ...@@ -45,9 +46,11 @@ open class Toolbar: Bar {
} }
/// Title label. /// Title label.
open fileprivate(set) lazy var titleLabel = UILabel() @IBInspectable
open let titleLabel = UILabel()
/// A convenience property to set the detailLabel text. /// A convenience property to set the detailLabel.text.
@IBInspectable
open var detail: String? { open var detail: String? {
get { get {
return detailLabel.text return detailLabel.text
...@@ -59,7 +62,8 @@ open class Toolbar: Bar { ...@@ -59,7 +62,8 @@ open class Toolbar: Bar {
} }
/// Detail label. /// Detail label.
open fileprivate(set) lazy var detailLabel = UILabel() @IBInspectable
open let detailLabel = UILabel()
deinit { deinit {
removeObserver(self, forKeyPath: "titleLabel.textAlignment") removeObserver(self, forKeyPath: "titleLabel.textAlignment")
...@@ -142,9 +146,11 @@ open class Toolbar: Bar { ...@@ -142,9 +146,11 @@ open class Toolbar: Bar {
prepareTitleLabel() prepareTitleLabel()
prepareDetailLabel() prepareDetailLabel()
} }
}
extension Toolbar {
/// Prepares the titleLabel. /// Prepares the titleLabel.
private func prepareTitleLabel() { fileprivate func prepareTitleLabel() {
titleLabel.textAlignment = .center titleLabel.textAlignment = .center
titleLabel.contentScaleFactor = Screen.scale titleLabel.contentScaleFactor = Screen.scale
titleLabel.font = RobotoFont.medium(with: 17) titleLabel.font = RobotoFont.medium(with: 17)
...@@ -153,7 +159,7 @@ open class Toolbar: Bar { ...@@ -153,7 +159,7 @@ open class Toolbar: Bar {
} }
/// Prepares the detailLabel. /// Prepares the detailLabel.
private func prepareDetailLabel() { fileprivate func prepareDetailLabel() {
detailLabel.textAlignment = .center detailLabel.textAlignment = .center
detailLabel.contentScaleFactor = Screen.scale detailLabel.contentScaleFactor = Screen.scale
detailLabel.font = RobotoFont.regular(with: 12) detailLabel.font = RobotoFont.regular(with: 12)
......
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