Commit 8152043b by Daniel Dahan

updated NavigationBar project

parent 5e6d8784
...@@ -112,9 +112,11 @@ class AppSearchBarViewController: SearchBarViewController { ...@@ -112,9 +112,11 @@ class AppSearchBarViewController: SearchBarViewController {
searchBarView.placeholderTextColor = MaterialColor.grey.darken4 searchBarView.placeholderTextColor = MaterialColor.grey.darken4
searchBarView.textField.font = RobotoFont.regular searchBarView.textField.font = RobotoFont.regular
searchBarView.textField.delegate = self searchBarView.textField.delegate = self
searchBarView.contentInset.left = 8
searchBarView.contentInset.right = 8
searchBarView.clearButton = clearButton searchBarView.clearButton = clearButton
searchBarView.rightControls = [backButton] searchBarView.leftControls = [backButton]
} }
} }
......
...@@ -70,6 +70,8 @@ class FeedViewController: UIViewController { ...@@ -70,6 +70,8 @@ class FeedViewController: UIViewController {
navigationbar.backgroundColor = MaterialColor.blue.base navigationbar.backgroundColor = MaterialColor.blue.base
navigationbar.backButton.tintColor = MaterialColor.white navigationbar.backButton.tintColor = MaterialColor.white
} }
collectionView.reloadData()
} }
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) { override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
......
...@@ -109,8 +109,6 @@ class ViewController: UIViewController { ...@@ -109,8 +109,6 @@ class ViewController: UIViewController {
view.addSubview(navigationBar) view.addSubview(navigationBar)
menuButton.backgroundColor = MaterialColor.yellow.accent1
let item: UINavigationItem = UINavigationItem() let item: UINavigationItem = UINavigationItem()
item.titleLabel = titleLabel item.titleLabel = titleLabel
item.leftControls = [menuButton] item.leftControls = [menuButton]
......
...@@ -250,11 +250,11 @@ public class NavigationBar : UINavigationBar { ...@@ -250,11 +250,11 @@ public class NavigationBar : UINavigationBar {
public override func layoutSubviews() { public override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
if let item: UINavigationItem = backItem { if let item: UINavigationItem = topItem {
item.titleView?.grid.reloadLayout()
} else if let item: UINavigationItem = topItem {
layoutNavigationItem(item) layoutNavigationItem(item)
} }
topItem?.titleView?.grid.reloadLayout()
} }
public override func pushNavigationItem(item: UINavigationItem, animated: Bool) { public override func pushNavigationItem(item: UINavigationItem, animated: Bool) {
...@@ -311,14 +311,13 @@ public class NavigationBar : UINavigationBar { ...@@ -311,14 +311,13 @@ public class NavigationBar : UINavigationBar {
if 32 >= height || nil == item.detailLabel { if 32 >= height || nil == item.detailLabel {
t.font = t.font?.fontWithSize(20) t.font = t.font?.fontWithSize(20)
item.titleView!.grid.axis.rows = 1 item.titleView!.grid.axis.rows = 1
item.detailLabel?.hidden = true
} else if let d: UILabel = item.detailLabel { } else if let d: UILabel = item.detailLabel {
d.grid.rows = 1 d.grid.rows = 1
d.hidden = false
d.font = d.font.fontWithSize(12) d.font = d.font.fontWithSize(12)
t.font = t.font.fontWithSize(17) t.font = t.font.fontWithSize(17)
item.titleView!.addSubview(d) item.titleView!.addSubview(d)
item.titleView!.grid.axis.rows = 2 item.titleView!.grid.axis.rows = 2
item.titleView!.grid.views?.append(d) item.titleView!.grid.views?.append(d)
...@@ -367,7 +366,7 @@ public class NavigationBar : UINavigationBar { ...@@ -367,7 +366,7 @@ public class NavigationBar : UINavigationBar {
backButtonImage = nil backButtonImage = nil
backgroundColor = MaterialColor.white backgroundColor = MaterialColor.white
depth = .Depth1 depth = .Depth1
contentInset = UIEdgeInsetsMake(2, 6, 2, 6) contentInset = UIEdgeInsetsMake(2, 2, 2, 2)
prepareBackButton() prepareBackButton()
} }
......
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