Commit dadbbd33 by Daniel Dahan

fixed issue-220

parent b1f7f4c2
...@@ -294,9 +294,11 @@ public class NavigationBar : UINavigationBar { ...@@ -294,9 +294,11 @@ public class NavigationBar : UINavigationBar {
// Set the titleView if title is empty. // Set the titleView if title is empty.
if "" == item.title { if "" == item.title {
if nil == item.titleView {
item.titleView = UIView(frame: CGRectMake(0, contentInset.top, MaterialDevice.width < MaterialDevice.height ? MaterialDevice.height : MaterialDevice.width, intrinsicContentSize().height - contentInset.top - contentInset.bottom)) item.titleView = UIView(frame: CGRectMake(0, contentInset.top, MaterialDevice.width < MaterialDevice.height ? MaterialDevice.height : MaterialDevice.width, intrinsicContentSize().height - contentInset.top - contentInset.bottom))
item.titleView!.autoresizingMask = [.FlexibleWidth] item.titleView!.autoresizingMask = [.FlexibleWidth]
item.titleView!.grid.axis.direction = .Vertical item.titleView!.grid.axis.direction = .Vertical
}
// TitleView alignment. // TitleView alignment.
if let t: UILabel = item.titleLabel { if let t: UILabel = item.titleLabel {
...@@ -352,6 +354,7 @@ public class NavigationBar : UINavigationBar { ...@@ -352,6 +354,7 @@ public class NavigationBar : UINavigationBar {
leftSpacer.width = inset + contentInset.left leftSpacer.width = inset + contentInset.left
} }
item.titleView?.frame.size.width = width
item.titleView?.frame.size.height = height - contentInset.top - contentInset.bottom item.titleView?.frame.size.height = height - contentInset.top - contentInset.bottom
if let t: UILabel = item.titleLabel { if let t: UILabel = item.titleLabel {
......
...@@ -34,9 +34,10 @@ import UIKit ...@@ -34,9 +34,10 @@ import UIKit
private var NavigationItemKey: UInt8 = 0 private var NavigationItemKey: UInt8 = 0
public class NavigationItem { public class NavigationItem {
/// Inset. /// Portrait inset.
public var portraitInset: CGFloat public var portraitInset: CGFloat
/// Landscape inset.
public var landscapeInset: CGFloat public var landscapeInset: CGFloat
/// Detail View. /// Detail View.
......
...@@ -140,7 +140,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -140,7 +140,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
leftView is closed. The leftViewThreshold is always at half leftView is closed. The leftViewThreshold is always at half
the width of the leftView. the width of the leftView.
*/ */
@IBInspectable public var leftViewThreshold: CGFloat = 0 @IBInspectable public var leftThreshold: CGFloat?
private var leftViewThreshold: CGFloat = 0
/** /**
A CGFloat property that accesses the rightView threshold of A CGFloat property that accesses the rightView threshold of
...@@ -150,7 +151,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -150,7 +151,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
rightView is opened. The rightViewThreshold is always at half rightView is opened. The rightViewThreshold is always at half
the width of the rightView. the width of the rightView.
*/ */
@IBInspectable public var rightViewThreshold: CGFloat = 0 @IBInspectable public var rightThreshold: CGFloat?
private var rightViewThreshold: CGFloat = 0
/** /**
A SideNavigationControllerDelegate property used to bind A SideNavigationControllerDelegate property used to bind
...@@ -865,7 +867,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -865,7 +867,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/// Toggles the statusBar /// Toggles the statusBar
private func toggleStatusBar() { private func toggleStatusBar() {
if MaterialDevice.landscape && .iPhone == MaterialDevice.type { if opened || MaterialDevice.landscape && .iPhone == MaterialDevice.type {
hideStatusBar() hideStatusBar()
} else { } else {
showStatusBar() showStatusBar()
...@@ -939,7 +941,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -939,7 +941,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
if let v: MaterialView = leftView { if let v: MaterialView = leftView {
v.width = leftViewWidth v.width = leftViewWidth
v.height = view.bounds.height v.height = view.bounds.height
leftViewThreshold = leftViewWidth / 2 leftViewThreshold = nil == leftThreshold ? leftViewWidth / 2 : leftThreshold!
if let vc: UIViewController = leftViewController { if let vc: UIViewController = leftViewController {
vc.view.frame.size.width = v.width vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height vc.view.frame.size.height = v.height
...@@ -950,7 +952,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel ...@@ -950,7 +952,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
if let v: MaterialView = rightView { if let v: MaterialView = rightView {
v.width = rightViewWidth v.width = rightViewWidth
v.height = view.bounds.height v.height = view.bounds.height
rightViewThreshold = view.bounds.width - rightViewWidth / 2 rightViewThreshold = nil == rightThreshold ? view.bounds.width - rightViewWidth / 2 : view.bounds.width - rightThreshold!
if let vc: UIViewController = rightViewController { if let vc: UIViewController = rightViewController {
vc.view.frame.size.width = v.width vc.view.frame.size.width = v.width
vc.view.frame.size.height = v.height vc.view.frame.size.height = v.height
......
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