Commit b1f7f4c2 by Daniel Dahan

updated bundle reference for CocoaPods

parent bcd19bd8
......@@ -52,25 +52,20 @@ class AppSearchBarController: SearchBarController {
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
searchBar.statusBarStyle = .Default
searchBar.textField.becomeFirstResponder()
sideNavigationController?.delegate = self
sideNavigationController?.enabled = false
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
searchBar.textField.becomeFirstResponder()
}
/// Toggle SideSearchViewController left UIViewController.
internal func handleBackButton() {
searchBar.textField.resignFirstResponder()
dismissViewControllerAnimated(true, completion: nil)
}
/// Toggle SideSearchViewController right UIViewController.
internal func handleMoreButton() {
searchBar.textField.resignFirstResponder()
print(presentingViewController?.view.layer.zPosition)
sideNavigationController?.enabledRightView = true
sideNavigationController?.toggleRightView()
}
/// Prepares view.
override func prepareView() {
super.prepareView()
......@@ -131,9 +126,3 @@ extension AppSearchBarController: TextFieldDelegate {
print("End searching....")
}
}
extension AppSearchBarController: SideNavigationControllerDelegate {
func sideNavigationDidClose(sideNavigationController: SideNavigationController, position: SideNavigationPosition) {
sideNavigationController.enabled = false
}
}
......@@ -10,4 +10,7 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '8.0'
s.source_files = 'Sources/*.swift'
s.requires_arc = true
s.resource_bundles = {
'io.cosmicmind.Material' => ['Sources/Assets.xcassets/**/*.png']
}
end
......@@ -341,6 +341,13 @@
name = Grid;
sourceTree = "<group>";
};
9666D3961C99297000F50E0E /* Assets */ = {
isa = PBXGroup;
children = (
);
name = Assets;
sourceTree = "<group>";
};
966F57B61C226D65009185B7 /* Text */ = {
isa = PBXGroup;
children = (
......@@ -402,6 +409,7 @@
96D88BF41C1328D800B91418 /* Sources */ = {
isa = PBXGroup;
children = (
9666D3961C99297000F50E0E /* Assets */,
96D88BFD1C1328D800B91418 /* LICENSE */,
96D88BFC1C1328D800B91418 /* Info.plist */,
96D88C091C1328D800B91418 /* Material.h */,
......
......@@ -35,10 +35,10 @@ public struct MaterialColor {
public static let clear: UIColor = UIColor.clearColor()
// white
public static let white: UIColor = UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1)
public static let white: UIColor = UIColor.whiteColor()
// black
public static let black: UIColor = UIColor(red: 0/255, green: 0/255, blue: 0/255, alpha: 1)
public static let black: UIColor = UIColor.blackColor()
// red
public struct red {
......
......@@ -297,7 +297,6 @@ public class NavigationBar : UINavigationBar {
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!.grid.axis.direction = .Vertical
item.titleView!.backgroundColor = MaterialColor.green.base
// TitleView alignment.
if let t: UILabel = item.titleLabel {
......
......@@ -211,7 +211,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
A Boolean property that triggers the status bar to be hidden
when the leftView is opened. Defaults to true.
*/
@IBInspectable public var hideStatusBar: Bool = true
@IBInspectable public var enableHideStatusbar: Bool = true
/**
A MaterialDepth property that is used to set the depth of the
......@@ -305,6 +305,18 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
layoutSubviews()
}
public override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransitionToSize(size, withTransitionCoordinator: coordinator)
if !MaterialDevice.landscape && .iPhone == MaterialDevice.type {
hideStatusBar()
} else {
showStatusBar()
}
if let v: MaterialView = rightView {
v.x = size.width - (openedRightView ? rightViewWidth : 0)
}
}
/**
A method to swap mainViewController objects.
- Parameter toViewController: The UIViewController to swap
......@@ -497,7 +509,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
public func openLeftView(velocity: CGFloat = 0) {
if enabledLeftView {
if let v: MaterialView = leftView {
toggleStatusBar(true)
hideStatusBar()
showView(v)
delegate?.sideNavigationWillOpen?(self, position: .Left)
......@@ -521,7 +533,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
public func openRightView(velocity: CGFloat = 0) {
if enabledRightView {
if let v: MaterialView = rightView {
toggleStatusBar(true)
hideStatusBar()
showView(v)
delegate?.sideNavigationWillOpen?(self, position: .Right)
......@@ -551,8 +563,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
animations: {
v.position.x = -v.width / 2
}) { [unowned self] _ in
self.toggleStatusBar(MaterialDevice.landscape && .iPhone == MaterialDevice.type)
self.hideView(v)
self.toggleStatusBar()
self.delegate?.sideNavigationDidClose?(self, position: .Left)
}
}
......@@ -574,8 +586,8 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
animations: { [unowned self] in
v.position.x = self.view.bounds.width + v.width / 2
}) { [unowned self] _ in
self.toggleStatusBar(MaterialDevice.landscape && .iPhone == MaterialDevice.type)
self.hideView(v)
self.toggleStatusBar()
self.delegate?.sideNavigationDidClose?(self, position: .Right)
}
}
......@@ -612,7 +624,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
case .Began:
originalX = v.position.x
toggleStatusBar(true)
hideStatusBar()
showView(v)
delegate?.sideNavigationPanDidBegin?(self, point: point, position: .Right)
......@@ -649,7 +661,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
case .Began:
originalX = v.position.x
toggleStatusBar(true)
hideStatusBar()
showView(v)
delegate?.sideNavigationPanDidBegin?(self, point: point, position: .Left)
......@@ -819,32 +831,45 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
}
}
/**
A method to toggle the status bar from a reveal state to
hidden state. The hideStatusBar property needs to be set
to true in order for this method to have any affect.
- Parameter hide: A Boolean indicating to show or hide
the status bar.
*/
private func toggleStatusBar(hide: Bool = false) {
// if hideStatusBar {
// userInteractionEnabled = false
// let hidden: Bool = opened ? true : hide
// UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
// animations: { [weak self] in
// self?.setNeedsStatusBarAppearanceUpdate()
// MaterialDevice.statusBarHidden = hidden
// }) { [weak self] _ in
// if false == self?.opened {
// self?.userInteractionEnabled = true
// }
// }
// delegate?.sideNavigationStatusBarHiddenState?(self, hidden: hidden)
// }
/// Shows the statusBar.
private func showStatusBar() {
userInteractionEnabled = false
UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
animations: { [weak self] in
self?.setNeedsStatusBarAppearanceUpdate()
MaterialDevice.statusBarHidden = false
}) { [weak self] _ in
if false == self?.opened {
self?.userInteractionEnabled = true
}
}
delegate?.sideNavigationStatusBarHiddenState?(self, hidden: false)
}
/// Hides the statusBar.
private func hideStatusBar() {
if enableHideStatusbar {
userInteractionEnabled = false
UIView.animateWithDuration(NSTimeInterval(UINavigationControllerHideShowBarDuration),
animations: { [weak self] in
self?.setNeedsStatusBarAppearanceUpdate()
MaterialDevice.statusBarHidden = true
}) { [weak self] _ in
if false == self?.opened {
self?.userInteractionEnabled = true
}
}
delegate?.sideNavigationStatusBarHiddenState?(self, hidden: true)
}
}
public override func preferredStatusBarUpdateAnimation() -> UIStatusBarAnimation {
return .Fade
/// Toggles the statusBar
private func toggleStatusBar() {
if MaterialDevice.landscape && .iPhone == MaterialDevice.type {
hideStatusBar()
} else {
showStatusBar()
}
}
/**
......@@ -909,7 +934,7 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
/// Layout subviews.
private func layoutSubviews() {
toggleStatusBar(MaterialDevice.landscape && .iPhone == MaterialDevice.type)
toggleStatusBar()
if let v: MaterialView = leftView {
v.width = leftViewWidth
......
......@@ -521,7 +521,7 @@ public class TextField : UITextField {
public func reloadView() {
/// Prepare the clearButton.
if let v: UIButton = clearButton {
v.frame = CGRectMake(0, 0, height, height)
v.frame = CGRectMake(width - height, 0, height, 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