Commit 7646c696 by Daniel Dahan

updated Toolbar and BarView for issue-381 and issue-382

parent 1819dd26
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9692C9761CEA3430008C2766 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9692C9751CEA3430008C2766 /* Material.framework */; };
9692C9771CEA3430008C2766 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9692C9751CEA3430008C2766 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96F2F1C71C97A52F00A5FE27 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F2F1C11C97A52F00A5FE27 /* AppDelegate.swift */; }; 96F2F1C71C97A52F00A5FE27 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F2F1C11C97A52F00A5FE27 /* AppDelegate.swift */; };
96F2F1C81C97A52F00A5FE27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F1C21C97A52F00A5FE27 /* Assets.xcassets */; }; 96F2F1C81C97A52F00A5FE27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F1C21C97A52F00A5FE27 /* Assets.xcassets */; };
96F2F1C91C97A52F00A5FE27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F1C31C97A52F00A5FE27 /* LaunchScreen.storyboard */; }; 96F2F1C91C97A52F00A5FE27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F1C31C97A52F00A5FE27 /* LaunchScreen.storyboard */; };
...@@ -22,7 +20,6 @@ ...@@ -22,7 +20,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
9692C9771CEA3430008C2766 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -30,7 +27,6 @@ ...@@ -30,7 +27,6 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9692C9751CEA3430008C2766 /* 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>"; };
96D88C7F1C132C1800B91418 /* Toolbar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Toolbar.app; sourceTree = BUILT_PRODUCTS_DIR; }; 96D88C7F1C132C1800B91418 /* Toolbar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Toolbar.app; sourceTree = BUILT_PRODUCTS_DIR; };
96F2F1C11C97A52F00A5FE27 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 96F2F1C11C97A52F00A5FE27 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96F2F1C21C97A52F00A5FE27 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 96F2F1C21C97A52F00A5FE27 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
...@@ -44,7 +40,6 @@ ...@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9692C9761CEA3430008C2766 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -54,7 +49,6 @@ ...@@ -54,7 +49,6 @@
96D88C761C132C1800B91418 = { 96D88C761C132C1800B91418 = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9692C9751CEA3430008C2766 /* Material.framework */,
96F2F1C01C97A52F00A5FE27 /* Toolbar */, 96F2F1C01C97A52F00A5FE27 /* Toolbar */,
96D88C801C132C1800B91418 /* Products */, 96D88C801C132C1800B91418 /* Products */,
); );
......
...@@ -38,12 +38,16 @@ import UIKit ...@@ -38,12 +38,16 @@ import UIKit
import Material import Material
class ViewController: UIViewController { class ViewController: UIViewController {
/// Reference for containerView.
private var containerView: UIView!
/// Reference for Toolbar. /// Reference for Toolbar.
private var toolbar: Toolbar! private var toolbar: Toolbar!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
prepareView() prepareView()
prepareContainerView()
prepareToolbar() prepareToolbar()
} }
...@@ -52,11 +56,18 @@ class ViewController: UIViewController { ...@@ -52,11 +56,18 @@ class ViewController: UIViewController {
view.backgroundColor = MaterialColor.white view.backgroundColor = MaterialColor.white
} }
/// Prepares the containerView.
private func prepareContainerView() {
containerView = UIView()
view.addSubview(containerView)
MaterialLayout.alignToParent(view, child: containerView, top: 100, left: 20, right: 20)
}
/// Prepares the toolbar /// Prepares the toolbar
private func prepareToolbar() { private func prepareToolbar() {
toolbar = Toolbar() toolbar = Toolbar()
containerView.addSubview(toolbar)
view.addSubview(toolbar)
// Title label. // Title label.
toolbar.titleLabel.text = "Material" toolbar.titleLabel.text = "Material"
......
...@@ -37,12 +37,6 @@ import UIKit ...@@ -37,12 +37,6 @@ import UIKit
import Material import Material
class AppToolbarController: ToolbarController { class AppToolbarController: ToolbarController {
override func viewDidLoad() {
super.viewDidLoad()
prepareView()
prepareToolbar()
}
override func viewWillAppear(animated: Bool) { override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
/* /*
...@@ -57,6 +51,7 @@ class AppToolbarController: ToolbarController { ...@@ -57,6 +51,7 @@ class AppToolbarController: ToolbarController {
override func prepareView() { override func prepareView() {
super.prepareView() super.prepareView()
view.backgroundColor = MaterialColor.black view.backgroundColor = MaterialColor.black
prepareToolbar()
} }
/// Toggle SideNavigationController right UIViewController. /// Toggle SideNavigationController right UIViewController.
...@@ -73,9 +68,7 @@ class AppToolbarController: ToolbarController { ...@@ -73,9 +68,7 @@ class AppToolbarController: ToolbarController {
private func prepareToolbar() { private func prepareToolbar() {
// Title label. // Title label.
toolbar.titleLabel.text = "Material" toolbar.titleLabel.text = "Material"
toolbar.titleLabel.textAlignment = .Left
toolbar.titleLabel.textColor = MaterialColor.white toolbar.titleLabel.textColor = MaterialColor.white
toolbar.titleLabel.font = RobotoFont.regular
// Detail label. Uncomment the code below to use a detail label. // Detail label. Uncomment the code below to use a detail label.
// toolbar.detailLabel.text = "Build Beautiful Software" // toolbar.detailLabel.text = "Build Beautiful Software"
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
9692C9791CEA34F7008C2766 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9692C9781CEA34F7008C2766 /* Material.framework */; };
9692C97A1CEA34F7008C2766 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9692C9781CEA34F7008C2766 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96F2F2151C97AFC600A5FE27 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F2F20D1C97AFC600A5FE27 /* AppDelegate.swift */; }; 96F2F2151C97AFC600A5FE27 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F2F20D1C97AFC600A5FE27 /* AppDelegate.swift */; };
96F2F2161C97AFC600A5FE27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F20E1C97AFC600A5FE27 /* Assets.xcassets */; }; 96F2F2161C97AFC600A5FE27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F20E1C97AFC600A5FE27 /* Assets.xcassets */; };
96F2F2171C97AFC600A5FE27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F20F1C97AFC600A5FE27 /* LaunchScreen.storyboard */; }; 96F2F2171C97AFC600A5FE27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F20F1C97AFC600A5FE27 /* LaunchScreen.storyboard */; };
...@@ -23,7 +21,6 @@ ...@@ -23,7 +21,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
9692C97A1CEA34F7008C2766 /* Material.framework in Embed Frameworks */,
); );
name = "Embed Frameworks"; name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
...@@ -31,7 +28,6 @@ ...@@ -31,7 +28,6 @@
/* End PBXCopyFilesBuildPhase section */ /* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
9692C9781CEA34F7008C2766 /* Material.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Material.framework; path = "/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-bshwisidfobstlbomegqyybbrygh/Build/Products/Debug-iphonesimulator/Material.framework"; sourceTree = "<absolute>"; };
96F2F20D1C97AFC600A5FE27 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; 96F2F20D1C97AFC600A5FE27 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96F2F20E1C97AFC600A5FE27 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 96F2F20E1C97AFC600A5FE27 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
96F2F2101C97AFC600A5FE27 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; 96F2F2101C97AFC600A5FE27 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
...@@ -46,7 +42,6 @@ ...@@ -46,7 +42,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
9692C9791CEA34F7008C2766 /* Material.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
...@@ -69,7 +64,6 @@ ...@@ -69,7 +64,6 @@
9ABEC5081C15085400F6895E = { 9ABEC5081C15085400F6895E = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
9692C9781CEA34F7008C2766 /* Material.framework */,
96F2F20C1C97AFC600A5FE27 /* Toolbar */, 96F2F20C1C97AFC600A5FE27 /* Toolbar */,
9ABEC5121C15085400F6895E /* Products */, 9ABEC5121C15085400F6895E /* Products */,
); );
......
...@@ -79,8 +79,8 @@ ...@@ -79,8 +79,8 @@
96BCB7DE1CB40DC500C806FE /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7951CB40DC500C806FE /* SearchBar.swift */; }; 96BCB7DE1CB40DC500C806FE /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7951CB40DC500C806FE /* SearchBar.swift */; };
96BCB7DF1CB40DC500C806FE /* SearchBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7961CB40DC500C806FE /* SearchBarController.swift */; }; 96BCB7DF1CB40DC500C806FE /* SearchBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7961CB40DC500C806FE /* SearchBarController.swift */; };
96BCB7E01CB40DC500C806FE /* SideNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7971CB40DC500C806FE /* SideNavigationController.swift */; }; 96BCB7E01CB40DC500C806FE /* SideNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7971CB40DC500C806FE /* SideNavigationController.swift */; };
96BCB7E11CB40DC500C806FE /* StatusBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7981CB40DC500C806FE /* StatusBarView.swift */; }; 96BCB7E11CB40DC500C806FE /* BarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7981CB40DC500C806FE /* BarView.swift */; };
96BCB7E21CB40DC500C806FE /* StatusBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7991CB40DC500C806FE /* StatusBarViewController.swift */; }; 96BCB7E21CB40DC500C806FE /* BarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7991CB40DC500C806FE /* BarViewController.swift */; };
96BCB7E31CB40DC500C806FE /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB79A1CB40DC500C806FE /* TabBar.swift */; }; 96BCB7E31CB40DC500C806FE /* TabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB79A1CB40DC500C806FE /* TabBar.swift */; };
96BCB7E41CB40DC500C806FE /* Text.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB79B1CB40DC500C806FE /* Text.swift */; }; 96BCB7E41CB40DC500C806FE /* Text.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB79B1CB40DC500C806FE /* Text.swift */; };
96BCB7E51CB40DC500C806FE /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB79C1CB40DC500C806FE /* TextField.swift */; }; 96BCB7E51CB40DC500C806FE /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB79C1CB40DC500C806FE /* TextField.swift */; };
...@@ -143,8 +143,8 @@ ...@@ -143,8 +143,8 @@
96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7951CB40DC500C806FE /* SearchBar.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7951CB40DC500C806FE /* SearchBar.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7961CB40DC500C806FE /* SearchBarController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7961CB40DC500C806FE /* SearchBarController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83B1CB4115200C806FE /* SideNavigationController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7971CB40DC500C806FE /* SideNavigationController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB83B1CB4115200C806FE /* SideNavigationController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7971CB40DC500C806FE /* SideNavigationController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83C1CB4115200C806FE /* StatusBarView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7981CB40DC500C806FE /* StatusBarView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB83C1CB4115200C806FE /* BarView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7981CB40DC500C806FE /* BarView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83D1CB4115200C806FE /* StatusBarViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7991CB40DC500C806FE /* StatusBarViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB83D1CB4115200C806FE /* BarViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7991CB40DC500C806FE /* BarViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83E1CB4115200C806FE /* Menu.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78D1CB40DC500C806FE /* Menu.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB83E1CB4115200C806FE /* Menu.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78D1CB40DC500C806FE /* Menu.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83F1CB4115200C806FE /* MenuView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78E1CB40DC500C806FE /* MenuView.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB83F1CB4115200C806FE /* MenuView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78E1CB40DC500C806FE /* MenuView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8401CB4115200C806FE /* MenuViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78F1CB40DC500C806FE /* MenuViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; }; 96BCB8401CB4115200C806FE /* MenuViewController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78F1CB40DC500C806FE /* MenuViewController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
...@@ -268,8 +268,8 @@ ...@@ -268,8 +268,8 @@
96BCB7951CB40DC500C806FE /* SearchBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; }; 96BCB7951CB40DC500C806FE /* SearchBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; };
96BCB7961CB40DC500C806FE /* SearchBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarController.swift; sourceTree = "<group>"; }; 96BCB7961CB40DC500C806FE /* SearchBarController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchBarController.swift; sourceTree = "<group>"; };
96BCB7971CB40DC500C806FE /* SideNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavigationController.swift; sourceTree = "<group>"; }; 96BCB7971CB40DC500C806FE /* SideNavigationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SideNavigationController.swift; sourceTree = "<group>"; };
96BCB7981CB40DC500C806FE /* StatusBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusBarView.swift; sourceTree = "<group>"; }; 96BCB7981CB40DC500C806FE /* BarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarView.swift; sourceTree = "<group>"; };
96BCB7991CB40DC500C806FE /* StatusBarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusBarViewController.swift; sourceTree = "<group>"; }; 96BCB7991CB40DC500C806FE /* BarViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarViewController.swift; sourceTree = "<group>"; };
96BCB79A1CB40DC500C806FE /* TabBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = "<group>"; }; 96BCB79A1CB40DC500C806FE /* TabBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBar.swift; sourceTree = "<group>"; };
96BCB79B1CB40DC500C806FE /* Text.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Text.swift; sourceTree = "<group>"; }; 96BCB79B1CB40DC500C806FE /* Text.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Text.swift; sourceTree = "<group>"; };
96BCB79C1CB40DC500C806FE /* TextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = "<group>"; }; 96BCB79C1CB40DC500C806FE /* TextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = "<group>"; };
...@@ -424,11 +424,11 @@ ...@@ -424,11 +424,11 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96BCB75E1CB40DC500C806FE /* ControlView.swift */, 96BCB75E1CB40DC500C806FE /* ControlView.swift */,
96BCB7981CB40DC500C806FE /* BarView.swift */,
96BCB7991CB40DC500C806FE /* BarViewController.swift */,
96BCB7951CB40DC500C806FE /* SearchBar.swift */, 96BCB7951CB40DC500C806FE /* SearchBar.swift */,
96BCB7961CB40DC500C806FE /* SearchBarController.swift */, 96BCB7961CB40DC500C806FE /* SearchBarController.swift */,
96BCB7971CB40DC500C806FE /* SideNavigationController.swift */, 96BCB7971CB40DC500C806FE /* SideNavigationController.swift */,
96BCB7981CB40DC500C806FE /* StatusBarView.swift */,
96BCB7991CB40DC500C806FE /* StatusBarViewController.swift */,
96BCB78D1CB40DC500C806FE /* Menu.swift */, 96BCB78D1CB40DC500C806FE /* Menu.swift */,
96BCB78E1CB40DC500C806FE /* MenuView.swift */, 96BCB78E1CB40DC500C806FE /* MenuView.swift */,
96BCB78F1CB40DC500C806FE /* MenuViewController.swift */, 96BCB78F1CB40DC500C806FE /* MenuViewController.swift */,
...@@ -664,8 +664,8 @@ ...@@ -664,8 +664,8 @@
96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */, 96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */,
96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */, 96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */,
96BCB83B1CB4115200C806FE /* SideNavigationController.swift in Headers */, 96BCB83B1CB4115200C806FE /* SideNavigationController.swift in Headers */,
96BCB83C1CB4115200C806FE /* StatusBarView.swift in Headers */, 96BCB83C1CB4115200C806FE /* BarView.swift in Headers */,
96BCB83D1CB4115200C806FE /* StatusBarViewController.swift in Headers */, 96BCB83D1CB4115200C806FE /* BarViewController.swift in Headers */,
96BCB83E1CB4115200C806FE /* Menu.swift in Headers */, 96BCB83E1CB4115200C806FE /* Menu.swift in Headers */,
96BCB83F1CB4115200C806FE /* MenuView.swift in Headers */, 96BCB83F1CB4115200C806FE /* MenuView.swift in Headers */,
96BCB8401CB4115200C806FE /* MenuViewController.swift in Headers */, 96BCB8401CB4115200C806FE /* MenuViewController.swift in Headers */,
...@@ -909,7 +909,7 @@ ...@@ -909,7 +909,7 @@
96BCB7E71CB40DC500C806FE /* TextView.swift in Sources */, 96BCB7E71CB40DC500C806FE /* TextView.swift in Sources */,
96BCB7C31CB40DC500C806FE /* MaterialEdgeInset.swift in Sources */, 96BCB7C31CB40DC500C806FE /* MaterialEdgeInset.swift in Sources */,
96BCB7CE1CB40DC500C806FE /* MaterialRadius.swift in Sources */, 96BCB7CE1CB40DC500C806FE /* MaterialRadius.swift in Sources */,
96BCB7E11CB40DC500C806FE /* StatusBarView.swift in Sources */, 96BCB7E11CB40DC500C806FE /* BarView.swift in Sources */,
96BCB7A11CB40DC500C806FE /* BottomNavigationController.swift in Sources */, 96BCB7A11CB40DC500C806FE /* BottomNavigationController.swift in Sources */,
96BCB7D81CB40DC500C806FE /* MenuViewController.swift in Sources */, 96BCB7D81CB40DC500C806FE /* MenuViewController.swift in Sources */,
96BCB7D41CB40DC500C806FE /* MaterialTransitionAnimation.swift in Sources */, 96BCB7D41CB40DC500C806FE /* MaterialTransitionAnimation.swift in Sources */,
...@@ -922,7 +922,7 @@ ...@@ -922,7 +922,7 @@
96BCB7B81CB40DC500C806FE /* MaterialBorder.swift in Sources */, 96BCB7B81CB40DC500C806FE /* MaterialBorder.swift in Sources */,
96BCB7A61CB40DC500C806FE /* CardView.swift in Sources */, 96BCB7A61CB40DC500C806FE /* CardView.swift in Sources */,
96BCB7C91CB40DC500C806FE /* MaterialLayer.swift in Sources */, 96BCB7C91CB40DC500C806FE /* MaterialLayer.swift in Sources */,
96BCB7E21CB40DC500C806FE /* StatusBarViewController.swift in Sources */, 96BCB7E21CB40DC500C806FE /* BarViewController.swift in Sources */,
96BCB7DC1CB40DC500C806FE /* RaisedButton.swift in Sources */, 96BCB7DC1CB40DC500C806FE /* RaisedButton.swift in Sources */,
96BCB7DD1CB40DC500C806FE /* RobotoFont.swift in Sources */, 96BCB7DD1CB40DC500C806FE /* RobotoFont.swift in Sources */,
96BCB7D71CB40DC500C806FE /* MenuView.swift in Sources */, 96BCB7D71CB40DC500C806FE /* MenuView.swift in Sources */,
......
...@@ -30,16 +30,7 @@ ...@@ -30,16 +30,7 @@
import UIKit import UIKit
public class StatusBarView : ControlView { public class BarView : ControlView {
/// The height of the StatusBar.
@IBInspectable public var heightForStatusBar: CGFloat = 20
/// The height when in Portrait orientation mode.
@IBInspectable public var heightForPortraitOrientation: CGFloat = 64
/// The height when in Landscape orientation mode.
@IBInspectable public var heightForLandscapeOrientation: CGFloat = 44
/// Device status bar style. /// Device status bar style.
public var statusBarStyle: UIStatusBarStyle { public var statusBarStyle: UIStatusBarStyle {
get { get {
...@@ -50,9 +41,6 @@ public class StatusBarView : ControlView { ...@@ -50,9 +41,6 @@ public class StatusBarView : ControlView {
} }
} }
/// Handles the rotation factor top inset.
internal var rotationFactor: CGFloat = 0
/// A convenience initializer. /// A convenience initializer.
public convenience init() { public convenience init() {
self.init(frame: CGRectZero) self.init(frame: CGRectZero)
...@@ -68,35 +56,8 @@ public class StatusBarView : ControlView { ...@@ -68,35 +56,8 @@ public class StatusBarView : ControlView {
prepareProperties(leftControls, rightControls: rightControls) prepareProperties(leftControls, rightControls: rightControls)
} }
public override func layoutSubviews() {
// Ensures a width.
if !willRenderView {
width = MaterialDevice.width
}
grid.axis.columns = Int(width / 24)
// General alignment.
if .iPhone == MaterialDevice.type && MaterialDevice.isLandscape {
if heightForStatusBar == rotationFactor {
contentInset.top -= rotationFactor
rotationFactor = 0
}
height = heightForLandscapeOrientation
} else {
if 0 == rotationFactor {
rotationFactor = heightForStatusBar
contentInset.top += rotationFactor
}
height = heightForPortraitOrientation
}
// We can call super now that we have a width.
super.layoutSubviews()
}
public override func intrinsicContentSize() -> CGSize { public override func intrinsicContentSize() -> CGSize {
return CGSizeMake(width, 0 < height ? height : .iPhone == MaterialDevice.type && MaterialDevice.isLandscape ? heightForLandscapeOrientation : heightForPortraitOrientation) return CGSizeMake(width, 44 + contentInset.top + contentInset.bottom)
} }
/** /**
......
...@@ -31,15 +31,7 @@ ...@@ -31,15 +31,7 @@
import UIKit import UIKit
@IBDesignable @IBDesignable
public class StatusBarViewController : UIViewController { public class BarViewController : UIViewController {
/// The height of the StatusBar.
@IBInspectable public var heightForStatusBar: CGFloat = 20
/// The height when in Portrait orientation mode.
@IBInspectable public var heightForPortraitOrientation: CGFloat = 64
/// The height when in Landscape orientation mode.
@IBInspectable public var heightForLandscapeOrientation: CGFloat = 44
/** /**
A Boolean property used to enable and disable interactivity A Boolean property used to enable and disable interactivity
...@@ -82,7 +74,7 @@ public class StatusBarViewController : UIViewController { ...@@ -82,7 +74,7 @@ public class StatusBarViewController : UIViewController {
} }
/** /**
An initializer for the StatusBarViewController. An initializer for the BarViewController.
- Parameter rootViewController: The main UIViewController. - Parameter rootViewController: The main UIViewController.
*/ */
public init(rootViewController: UIViewController) { public init(rootViewController: UIViewController) {
...@@ -140,25 +132,6 @@ public class StatusBarViewController : UIViewController { ...@@ -140,25 +132,6 @@ public class StatusBarViewController : UIViewController {
prepareRootViewController() prepareRootViewController()
} }
public override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
layoutSubviews()
}
/// Layout subviews.
private func layoutSubviews() {
let h: CGFloat = MaterialDevice.height
let q: CGFloat = UIApplication.sharedApplication().statusBarFrame.size.height
if .iPhone == MaterialDevice.type && MaterialDevice.isLandscape {
rootViewController.view.frame.origin.y = heightForLandscapeOrientation
rootViewController.view.frame.size.height = h - (heightForStatusBar >= q ? heightForLandscapeOrientation : q - heightForStatusBar - heightForLandscapeOrientation)
} else {
rootViewController.view.frame.origin.y = heightForPortraitOrientation
rootViewController.view.frame.size.height = h - (heightForStatusBar >= q ? heightForPortraitOrientation : q - heightForStatusBar - heightForPortraitOrientation)
}
}
/// A method that prepares the rootViewController. /// A method that prepares the rootViewController.
private func prepareRootViewController() { private func prepareRootViewController() {
rootViewController.view.clipsToBounds = true rootViewController.view.clipsToBounds = true
...@@ -168,7 +141,7 @@ public class StatusBarViewController : UIViewController { ...@@ -168,7 +141,7 @@ public class StatusBarViewController : UIViewController {
/** /**
A method that adds the passed in controller as a child of A method that adds the passed in controller as a child of
the StatusBarViewController within the passed in the BarViewController within the passed in
container view. container view.
- Parameter viewController: A UIViewController to add as a child. - Parameter viewController: A UIViewController to add as a child.
- Parameter container: A UIView that is the parent of the - Parameter container: A UIView that is the parent of the
......
...@@ -143,6 +143,12 @@ public class ControlView : MaterialView { ...@@ -143,6 +143,12 @@ public class ControlView : MaterialView {
public override func layoutSubviews() { public override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
if willRenderView { if willRenderView {
layoutIfNeeded()
if 0 == frame.size.height {
frame.size.height = intrinsicContentSize().height
}
let factor: CGFloat = 24 let factor: CGFloat = 24
if let g: Int = Int(width / factor) { if let g: Int = Int(width / factor) {
let columns: Int = g + 1 let columns: Int = g + 1
......
...@@ -94,7 +94,7 @@ public class MenuViewController : UIViewController { ...@@ -94,7 +94,7 @@ public class MenuViewController : UIViewController {
} }
/** /**
An initializer for the StatusBarViewController. An initializer for the BarViewController.
- Parameter rootViewController: The main UIViewController. - Parameter rootViewController: The main UIViewController.
*/ */
public init(rootViewController: UIViewController) { public init(rootViewController: UIViewController) {
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
import UIKit import UIKit
public class SearchBar : StatusBarView { public class SearchBar : BarView {
/// The UITextField for the searchBar. /// The UITextField for the searchBar.
public private(set) var textField: UITextField! public private(set) var textField: UITextField!
......
...@@ -48,37 +48,7 @@ public extension UIViewController { ...@@ -48,37 +48,7 @@ public extension UIViewController {
} }
} }
public class SearchBarController : StatusBarViewController { public class SearchBarController : BarViewController {
/// The height of the StatusBar.
@IBInspectable public override var heightForStatusBar: CGFloat {
get {
return searchBar.heightForStatusBar
}
set(value) {
searchBar.heightForStatusBar = value
}
}
/// The height when in Portrait orientation mode.
@IBInspectable public override var heightForPortraitOrientation: CGFloat {
get {
return searchBar.heightForPortraitOrientation
}
set(value) {
searchBar.heightForPortraitOrientation = value
}
}
/// The height when in Landscape orientation mode.
@IBInspectable public override var heightForLandscapeOrientation: CGFloat {
get {
return searchBar.heightForLandscapeOrientation
}
set(value) {
searchBar.heightForLandscapeOrientation = value
}
}
/// Reference to the SearchBar. /// Reference to the SearchBar.
public private(set) lazy var searchBar: SearchBar = SearchBar() public private(set) lazy var searchBar: SearchBar = SearchBar()
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
import UIKit import UIKit
public class Toolbar : StatusBarView { public class Toolbar : BarView {
/// Title label. /// Title label.
public private(set) var titleLabel: UILabel! public private(set) var titleLabel: UILabel!
......
...@@ -64,37 +64,7 @@ public protocol ToolbarControllerDelegate : MaterialDelegate { ...@@ -64,37 +64,7 @@ public protocol ToolbarControllerDelegate : MaterialDelegate {
} }
@objc(ToolbarController) @objc(ToolbarController)
public class ToolbarController : StatusBarViewController { public class ToolbarController : BarViewController {
/// The height of the StatusBar.
@IBInspectable public override var heightForStatusBar: CGFloat {
get {
return toolbar.heightForStatusBar
}
set(value) {
toolbar.heightForStatusBar = value
}
}
/// The height when in Portrait orientation mode.
@IBInspectable public override var heightForPortraitOrientation: CGFloat {
get {
return toolbar.heightForPortraitOrientation
}
set(value) {
toolbar.heightForPortraitOrientation = value
}
}
/// The height when in Landscape orientation mode.
@IBInspectable public override var heightForLandscapeOrientation: CGFloat {
get {
return toolbar.heightForLandscapeOrientation
}
set(value) {
toolbar.heightForLandscapeOrientation = value
}
}
/// Internal reference to the floatingViewController. /// Internal reference to the floatingViewController.
private var internalFloatingViewController: UIViewController? private var internalFloatingViewController: UIViewController?
...@@ -130,7 +100,7 @@ public class ToolbarController : StatusBarViewController { ...@@ -130,7 +100,7 @@ public class ToolbarController : StatusBarViewController {
dispatch_async(dispatch_get_main_queue()) { [unowned self] in dispatch_async(dispatch_get_main_queue()) { [unowned self] in
self.delegate?.toolbarControllerDidCloseFloatingViewController?(self) self.delegate?.toolbarControllerDidCloseFloatingViewController?(self)
} }
} }
} }
if let v: UIViewController = value { if let v: UIViewController = value {
...@@ -164,11 +134,16 @@ public class ToolbarController : StatusBarViewController { ...@@ -164,11 +134,16 @@ public class ToolbarController : StatusBarViewController {
dispatch_async(dispatch_get_main_queue()) { [unowned self] in dispatch_async(dispatch_get_main_queue()) { [unowned self] in
self.delegate?.toolbarControllerDidOpenFloatingViewController?(self) self.delegate?.toolbarControllerDidOpenFloatingViewController?(self)
} }
} }
} }
} }
} }
public override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
layoutSubviews()
}
/** /**
Prepares the view instance when intialized. When subclassing, Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method it is recommended to override the prepareView method
...@@ -181,6 +156,21 @@ public class ToolbarController : StatusBarViewController { ...@@ -181,6 +156,21 @@ public class ToolbarController : StatusBarViewController {
prepareToolbar() prepareToolbar()
} }
/// Layout subviews.
public func layoutSubviews() {
let h: CGFloat = MaterialDevice.height
if .iPhone == MaterialDevice.type && MaterialDevice.isLandscape {
toolbar.contentInset.top = 24
} else {
toolbar.contentInset.top = 4
}
let p: CGFloat = toolbar.intrinsicContentSize().height
rootViewController.view.frame.origin.y = p
rootViewController.view.frame.size.height = h - p
}
/// Prepares the Toolbar. /// Prepares the Toolbar.
private func prepareToolbar() { private func prepareToolbar() {
toolbar.zPosition = 1000 toolbar.zPosition = 1000
......
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