Commit 4dbaa51d by Daniel Dahan

adjusted sizing for NavigationBar

parent beff5c45
......@@ -9,8 +9,8 @@
/* Begin PBXBuildFile section */
96162C6C1CA71C8700E3A235 /* VideoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6B1CA71C8700E3A235 /* VideoViewController.swift */; };
96162C6E1CA7274E00E3A235 /* PhotoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */; };
961F192F1CE14C3E008927C5 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 961F192E1CE14C3E008927C5 /* Material.framework */; };
961F19301CE14C3E008927C5 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 961F192E1CE14C3E008927C5 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
961F19321CE2579D008927C5 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 961F19311CE2579D008927C5 /* Material.framework */; };
961F19331CE2579D008927C5 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 961F19311CE2579D008927C5 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9663F9321C7A744600AF0965 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9311C7A744600AF0965 /* AppDelegate.swift */; };
9663F9341C7A744600AF0965 /* RecommendationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9331C7A744600AF0965 /* RecommendationViewController.swift */; };
9663F9391C7A744600AF0965 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9663F9381C7A744600AF0965 /* Assets.xcassets */; };
......@@ -30,7 +30,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
961F19301CE14C3E008927C5 /* Material.framework in Embed Frameworks */,
961F19331CE2579D008927C5 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -40,7 +40,7 @@
/* Begin PBXFileReference section */
96162C6B1CA71C8700E3A235 /* VideoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoViewController.swift; sourceTree = "<group>"; };
96162C6D1CA7274E00E3A235 /* PhotoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoViewController.swift; sourceTree = "<group>"; };
961F192E1CE14C3E008927C5 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
961F19311CE2579D008927C5 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/CosmicMind-hgvxkqfizbxkrsfcxbtlafgqkbve/Build/Products/Debug-iphoneos/Material.framework"; sourceTree = "<absolute>"; };
9663F92E1C7A744600AF0965 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
9663F9311C7A744600AF0965 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
9663F9331C7A744600AF0965 /* RecommendationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecommendationViewController.swift; sourceTree = "<group>"; };
......@@ -60,7 +60,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
961F192F1CE14C3E008927C5 /* Material.framework in Frameworks */,
961F19321CE2579D008927C5 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -70,7 +70,7 @@
9663F9251C7A744500AF0965 = {
isa = PBXGroup;
children = (
961F192E1CE14C3E008927C5 /* Material.framework */,
961F19311CE2579D008927C5 /* Material.framework */,
9663F9301C7A744600AF0965 /* App */,
9663F92F1C7A744600AF0965 /* Products */,
);
......
......@@ -66,7 +66,6 @@ class ItemViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareTitleLabel()
prepareShareButton()
prepareNavigationItem()
prepareScrollView()
......@@ -101,22 +100,6 @@ class ItemViewController: UIViewController {
automaticallyAdjustsScrollViewInsets = false
}
/// Prepares the titleLabel.
private func prepareTitleLabel() {
titleLabel = UILabel()
titleLabel.text = "Item"
titleLabel.textAlignment = .Left
titleLabel.textColor = MaterialColor.white
}
/// Prepares the detailLabel.
private func prepareDetailLabel() {
detailLabel = UILabel()
detailLabel.text = "January 22, 2016"
detailLabel.textAlignment = .Left
detailLabel.textColor = MaterialColor.white
}
/// Prepares the shareButton.
private func prepareShareButton() {
let image: UIImage? = MaterialIcon.cm.share
......@@ -128,8 +111,14 @@ class ItemViewController: UIViewController {
/// Prepares the navigationItem.
private func prepareNavigationItem() {
navigationItem.titleLabel = titleLabel
navigationItem.detailLabel = detailLabel
navigationItem.title = "Item"
navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.textColor = MaterialColor.white
navigationItem.detail = "January 22, 2016"
navigationItem.detailLabel.textAlignment = .Left
navigationItem.detailLabel.textColor = MaterialColor.white
navigationItem.rightControls = [shareButton]
}
......@@ -163,8 +152,8 @@ class ItemViewController: UIViewController {
detailLabel.font = RobotoFont.regular
detailLabel.numberOfLines = 0
imageCardView.detailView = detailLabel
imageCardView.detailViewInset.top = 52
imageCardView.contentView = detailLabel
imageCardView.contentViewInset.top = 52
let image: UIImage? = UIImage(named: data["image"] as! String)
imageCardView.image = image
......
......@@ -54,7 +54,6 @@ class RecipesViewController: UIViewController {
super.viewDidLoad()
prepareView()
prepareItems()
prepareTitleLabel()
prepareMenuButton()
prepareSwitchControl()
prepareSearchButton()
......@@ -218,14 +217,6 @@ class RecipesViewController: UIViewController {
view.backgroundColor = MaterialColor.white
}
/// Prepares the titleLabel.
private func prepareTitleLabel() {
titleLabel = UILabel()
titleLabel.text = "Recipes"
titleLabel.textAlignment = .Left
titleLabel.textColor = MaterialColor.white
}
/// Prepares the menuButton.
private func prepareMenuButton() {
let image: UIImage? = MaterialIcon.cm.menu
......@@ -253,7 +244,10 @@ class RecipesViewController: UIViewController {
/// Prepares the navigationItem.
private func prepareNavigationItem() {
navigationItem.titleLabel = titleLabel
navigationItem.title = "Recipes"
navigationItem.titleLabel.textAlignment = .Left
navigationItem.titleLabel.textColor = MaterialColor.white
navigationItem.leftControls = [menuButton]
navigationItem.rightControls = [switchControl, searchButton]
}
......
......@@ -61,7 +61,7 @@ class ViewController: UIViewController {
let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0
cardView.detailView = detailLabel
cardView.contentView = detailLabel
// Yes button.
let btn1: FlatButton = FlatButton()
......@@ -106,7 +106,7 @@ class ViewController: UIViewController {
detailLabel.text = "Beautiful Material Design"
detailLabel.textColor = MaterialColor.white
detailLabel.numberOfLines = 0
cardView.detailView = detailLabel
cardView.contentView = detailLabel
// Share button.
let img1: UIImage? = MaterialIcon.cm.share
......@@ -147,7 +147,7 @@ class ViewController: UIViewController {
detailLabel.text = "Data-Driven Framework"
detailLabel.textColor = MaterialColor.white
detailLabel.numberOfLines = 0
cardView.detailView = detailLabel
cardView.contentView = detailLabel
// Share button.
let img1: UIImage? = MaterialIcon.cm.share
......
......@@ -65,7 +65,7 @@ class ViewController: UIViewController {
let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0
imageCardView.detailView = detailLabel
imageCardView.contentView = detailLabel
// Yes button.
let btn1: FlatButton = FlatButton()
......
......@@ -29,7 +29,7 @@
*/
/*
The following is an example of setting a UITableView as the detailView for a
The following is an example of setting a UITableView as the contentView for a
CardView.
*/
......
......@@ -29,7 +29,7 @@
*/
/*
The following is an example of setting a UITableView as the detailView for a
The following is an example of setting a UITableView as the contentView for a
CardView.
*/
......@@ -91,7 +91,7 @@ class ViewController: UIViewController {
cardView.contentInsetPreset = .None
cardView.leftButtonsInsetPreset = .Square2
cardView.rightButtonsInsetPreset = .Square2
cardView.detailViewInsetPreset = .None
cardView.contentViewInsetPreset = .None
let titleLabel: UILabel = UILabel()
titleLabel.font = RobotoFont.mediumWithSize(20)
......@@ -113,7 +113,7 @@ class ViewController: UIViewController {
// Use MaterialLayout to easily align the tableView.
cardView.titleLabel = titleLabel
cardView.detailView = tableView
cardView.contentView = tableView
cardView.leftButtons = [closeButton]
cardView.rightButtons = [settingButton]
......
......@@ -60,7 +60,7 @@ class ViewController: UIViewController {
let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0
topCardView.detailView = detailLabel
topCardView.contentView = detailLabel
// Yes button.
let btn1: FlatButton = FlatButton()
......@@ -91,7 +91,7 @@ class ViewController: UIViewController {
let detailLabel: UILabel = UILabel()
detailLabel.text = "It’s been a while, have you read any new books lately?"
detailLabel.numberOfLines = 0
bottomCardView.detailView = detailLabel
bottomCardView.contentView = detailLabel
// Yes button.
let btn1: FlatButton = FlatButton()
......
......@@ -119,29 +119,29 @@ public class CardView : MaterialPulseView {
}
/**
:name: detailViewInsets
:name: contentViewInsets
*/
public var detailViewInsetPreset: MaterialEdgeInset = .Square2 {
public var contentViewInsetPreset: MaterialEdgeInset = .Square2 {
didSet {
detailViewInset = MaterialEdgeInsetToValue(detailViewInsetPreset)
contentViewInset = MaterialEdgeInsetToValue(contentViewInsetPreset)
}
}
/**
:name: detailViewInset
:name: contentViewInset
*/
@IBInspectable public var detailViewInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) {
@IBInspectable public var contentViewInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) {
didSet {
reloadView()
}
}
/**
:name: detailView
:name: contentView
*/
@IBInspectable public var detailView: UIView? {
@IBInspectable public var contentView: UIView? {
didSet {
detailView?.translatesAutoresizingMaskIntoConstraints = false
contentView?.translatesAutoresizingMaskIntoConstraints = false
reloadView()
}
}
......@@ -234,9 +234,9 @@ public class CardView : MaterialPulseView {
/**
:name: init
*/
public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, detailView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, contentView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
self.init(frame: CGRectZero)
prepareProperties(image, titleLabel: titleLabel, detailView: detailView, leftButtons: leftButtons, rightButtons: rightButtons)
prepareProperties(image, titleLabel: titleLabel, contentView: contentView, leftButtons: leftButtons, rightButtons: rightButtons)
}
/**
......@@ -279,9 +279,9 @@ public class CardView : MaterialPulseView {
if nil != titleLabel {
verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInset.top + titleLabelInset.top
} else if nil != detailView {
} else if nil != contentView {
verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInset.top + detailViewInset.top
metrics["insetTop"] = contentInset.top + contentViewInset.top
}
// title
......@@ -295,20 +295,20 @@ public class CardView : MaterialPulseView {
}
// detail
if let v: UIView = detailView {
if let v: UIView = contentView {
addSubview(v)
if nil == titleLabel {
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + detailViewInset.top
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + contentViewInset.top
} else {
verticalFormat += "-(insetB)"
metrics["insetB"] = titleLabelInset.bottom + detailViewInset.top
metrics["insetB"] = titleLabelInset.bottom + contentViewInset.top
}
verticalFormat += "-[detailView]"
views["detailView"] = v
verticalFormat += "-[contentView]"
views["contentView"] = v
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + detailViewInset.left, right: contentInset.right + detailViewInset.right)
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right)
}
// leftButtons
......@@ -382,11 +382,11 @@ public class CardView : MaterialPulseView {
metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom
}
if nil != detailView {
if nil != contentView {
if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInset.bottom + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
metrics["insetBottom"] = contentInset.bottom + contentViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
}
} else if nil != titleLabel {
if nil == metrics["insetC"] {
......@@ -430,10 +430,10 @@ public class CardView : MaterialPulseView {
/**
:name: prepareProperties
*/
internal func prepareProperties(image: UIImage?, titleLabel: UILabel?, detailView: UIView?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) {
internal func prepareProperties(image: UIImage?, titleLabel: UILabel?, contentView: UIView?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) {
self.image = image
self.titleLabel = titleLabel
self.detailView = detailView
self.contentView = contentView
self.leftButtons = leftButtons
self.rightButtons = rightButtons
}
......
......@@ -196,12 +196,6 @@ public class ControlView : MaterialView {
prepareContentView()
}
/// Prepares the contentView.
public func prepareContentView() {
contentView.backgroundColor = nil
addSubview(contentView)
}
/**
Used to trigger property changes that initializers avoid.
- Parameter leftControls: An Array of UIControls that go on the left side.
......@@ -211,4 +205,10 @@ public class ControlView : MaterialView {
self.leftControls = leftControls
self.rightControls = rightControls
}
/// Prepares the contentView.
private func prepareContentView() {
contentView.backgroundColor = nil
addSubview(contentView)
}
}
......@@ -212,29 +212,29 @@ public class ImageCardView : MaterialPulseView {
}
/**
:name: detailViewInsets
:name: contentViewInsets
*/
public var detailViewInsetPreset: MaterialEdgeInset = .Square2 {
public var contentViewInsetPreset: MaterialEdgeInset = .Square2 {
didSet {
detailViewInset = MaterialEdgeInsetToValue(detailViewInsetPreset)
contentViewInset = MaterialEdgeInsetToValue(contentViewInsetPreset)
}
}
/**
:name: detailViewInset
:name: contentViewInset
*/
@IBInspectable public var detailViewInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) {
@IBInspectable public var contentViewInset: UIEdgeInsets = MaterialEdgeInsetToValue(.Square2) {
didSet {
reloadView()
}
}
/**
:name: detailView
:name: contentView
*/
@IBInspectable public var detailView: UIView? {
@IBInspectable public var contentView: UIView? {
didSet {
detailView?.translatesAutoresizingMaskIntoConstraints = false
contentView?.translatesAutoresizingMaskIntoConstraints = false
reloadView()
}
}
......@@ -327,9 +327,9 @@ public class ImageCardView : MaterialPulseView {
/**
:name: init
*/
public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, detailView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
public convenience init?(image: UIImage? = nil, titleLabel: UILabel? = nil, contentView: UIView? = nil, leftButtons: Array<UIButton>? = nil, rightButtons: Array<UIButton>? = nil) {
self.init(frame: CGRectZero)
prepareProperties(image, titleLabel: titleLabel, detailView: detailView, leftButtons: leftButtons, rightButtons: rightButtons)
prepareProperties(image, titleLabel: titleLabel, contentView: contentView, leftButtons: leftButtons, rightButtons: rightButtons)
}
/**
......@@ -379,9 +379,9 @@ public class ImageCardView : MaterialPulseView {
} else if nil != titleLabel {
verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInset.top + titleLabelInset.top
} else if nil != detailView {
} else if nil != contentView {
verticalFormat += "-(insetTop)"
metrics["insetTop"] = contentInset.top + detailViewInset.top
metrics["insetTop"] = contentInset.top + contentViewInset.top
}
// title
......@@ -398,20 +398,20 @@ public class ImageCardView : MaterialPulseView {
}
// detail
if let v: UIView = detailView {
if let v: UIView = contentView {
addSubview(v)
if nil == imageLayer?.contents && nil != titleLabel {
verticalFormat += "-(insetB)"
metrics["insetB"] = titleLabelInset.bottom + detailViewInset.top
metrics["insetB"] = titleLabelInset.bottom + contentViewInset.top
} else {
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + detailViewInset.top
metrics["insetTop"] = (metrics["insetTop"] as! CGFloat) + contentViewInset.top
}
verticalFormat += "-[detailView]"
views["detailView"] = v
verticalFormat += "-[contentView]"
views["contentView"] = v
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + detailViewInset.left, right: contentInset.right + detailViewInset.right)
MaterialLayout.alignToParentHorizontally(self, child: v, left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right)
}
// leftButtons
......@@ -486,11 +486,11 @@ public class ImageCardView : MaterialPulseView {
metrics["insetBottom"] = contentInset.bottom + rightButtonsInset.bottom
}
if nil != detailView {
if nil != contentView {
if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInset.bottom + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
metrics["insetBottom"] = contentInset.bottom + contentViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
}
} else if nil != titleLabel {
if nil == metrics["insetC"] {
......@@ -501,7 +501,7 @@ public class ImageCardView : MaterialPulseView {
} else if nil != metrics["insetC"] {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentInset.top + (divider ? dividerInset.top + dividerInset.bottom : 0)
}
} else if nil != detailView {
} else if nil != contentView {
if 0 < leftButtons?.count {
verticalFormat += "-(insetC)-[button]"
views["button"] = leftButtons![0]
......@@ -515,9 +515,9 @@ public class ImageCardView : MaterialPulseView {
}
if nil == metrics["insetC"] {
metrics["insetBottom"] = contentInset.bottom + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
metrics["insetBottom"] = contentInset.bottom + contentViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
} else {
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + detailViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
metrics["insetC"] = (metrics["insetC"] as! CGFloat) + contentViewInset.bottom + (divider ? dividerInset.top + dividerInset.bottom : 0)
}
} else {
if 0 < leftButtons?.count {
......@@ -583,10 +583,10 @@ public class ImageCardView : MaterialPulseView {
/**
:name: prepareProperties
*/
internal func prepareProperties(image: UIImage?, titleLabel: UILabel?, detailView: UIView?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) {
internal func prepareProperties(image: UIImage?, titleLabel: UILabel?, contentView: UIView?, leftButtons: Array<UIButton>?, rightButtons: Array<UIButton>?) {
self.image = image
self.titleLabel = titleLabel
self.detailView = detailView
self.contentView = contentView
self.leftButtons = leftButtons
self.rightButtons = rightButtons
}
......
......@@ -349,6 +349,10 @@ public class MaterialButton : UIButton {
}
}
public override func alignmentRectInsets() -> UIEdgeInsets {
return UIEdgeInsetsZero
}
/**
A method that accepts CAAnimation objects and executes them on the
view's backing layer.
......
......@@ -114,7 +114,7 @@ public class NavigationController : UINavigationController, UIGestureRecognizerD
*/
public func navigationBar(navigationBar: UINavigationBar, shouldPushItem item: UINavigationItem) -> Bool {
if let v: NavigationBar = navigationBar as? NavigationBar {
item.setHidesBackButton(true, animated: false)
item.hidesBackButton = true
if var c: Array<UIControl> = item.leftControls {
c.append(v.backButton)
item.leftControls = c
......
......@@ -35,19 +35,27 @@ private var MaterialAssociatedObjectNavigationItemKey: UInt8 = 0
public class MaterialAssociatedObjectNavigationItem {
/// Detail View.
public var detailView: UIView?
public var contentView: UIView?
/// Title label.
public var titleLabel: UILabel?
public var titleLabel: UILabel
/// Detail text.
public var detail: String?
/// Detail label.
public var detailLabel: UILabel?
public var detailLabel: UILabel
/// Left controls.
public var leftControls: Array<UIControl>?
/// Right controls.
public var rightControls: Array<UIControl>?
public init() {
titleLabel = UILabel()
detailLabel = UILabel()
}
}
public extension UINavigationItem {
......@@ -64,17 +72,17 @@ public extension UINavigationItem {
}
/// Detail View.
public var detailView: UIView? {
public internal(set) var contentView: UIView? {
get {
return item.detailView
return item.contentView
}
set(value) {
item.detailView = value
item.contentView = value
}
}
/// Title Label.
public var titleLabel: UILabel? {
public internal(set) var titleLabel: UILabel {
get {
return item.titleLabel
}
......@@ -83,8 +91,18 @@ public extension UINavigationItem {
}
}
/// Detail text.
public var detail: String? {
get {
return item.detail
}
set(value) {
item.detail = value
}
}
/// Detail Label.
public var detailLabel: UILabel? {
public internal(set) var detailLabel: UILabel {
get {
return item.detailLabel
}
......
......@@ -99,9 +99,15 @@ public class SearchBar : StatusBarView {
}
}
/// Prepares the contentView.
public override func prepareContentView() {
super.prepareContentView()
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public override func prepareView() {
super.prepareView()
prepareTextField()
prepareClearButton()
}
......
......@@ -74,7 +74,7 @@ public class StatusBarView : ControlView {
width = MaterialDevice.width
}
grid.axis.columns = Int(width / 56)
grid.axis.columns = Int(width / 48)
// General alignment.
if .iPhone == MaterialDevice.type && MaterialDevice.isLandscape {
......
......@@ -101,9 +101,15 @@ public class Toolbar : StatusBarView {
}
}
/// Prepares the contentView.
public override func prepareContentView() {
super.prepareContentView()
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public override func prepareView() {
super.prepareView()
contentView.grid.axis.direction = .Vertical
}
......
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