Commit 73d4a6c0 by Daniel Dahan

issue-381: Where titleLabel and detailLabel were not being drawn, when a text…

issue-381: Where titleLabel and detailLabel were not being drawn, when a text value didn't exist. Otherwise, buttons would have had to been added.
parent 0cad3020
......@@ -126,9 +126,6 @@
location = "group:Storyboards/BottomTabBar/BottomTabBar.xcodeproj">
</FileRef>
<FileRef
location = "group:Storyboards/NavigationController/NavigationController.xcodeproj">
</FileRef>
<FileRef
location = "group:Storyboards/SideNavigationController/SideNavigationController.xcodeproj">
</FileRef>
</Group>
......
......@@ -18,8 +18,6 @@
9663F94C1C7A74C700AF0965 /* AppMenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94B1C7A74C700AF0965 /* AppMenuViewController.swift */; };
9663F94E1C7A74EA00AF0965 /* AppLeftViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */; };
9663F9521C7A751D00AF0965 /* ItemViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9663F9511C7A751D00AF0965 /* ItemViewController.swift */; };
9692C95B1CE6775E008C2766 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9692C95A1CE6775E008C2766 /* Material.framework */; };
9692C95C1CE6775E008C2766 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9692C95A1CE6775E008C2766 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96CC08881C7FEBD60034FF84 /* RecipesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */; };
/* End PBXBuildFile section */
......@@ -30,7 +28,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9692C95C1CE6775E008C2766 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -51,7 +48,6 @@
9663F94B1C7A74C700AF0965 /* AppMenuViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppMenuViewController.swift; sourceTree = "<group>"; };
9663F94D1C7A74EA00AF0965 /* AppLeftViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppLeftViewController.swift; sourceTree = "<group>"; };
9663F9511C7A751D00AF0965 /* ItemViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ItemViewController.swift; sourceTree = "<group>"; };
9692C95A1CE6775E008C2766 /* 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>"; };
96CC08871C7FEBD60034FF84 /* RecipesViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RecipesViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
......@@ -60,7 +56,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9692C95B1CE6775E008C2766 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -70,7 +65,6 @@
9663F9251C7A744500AF0965 = {
isa = PBXGroup;
children = (
9692C95A1CE6775E008C2766 /* Material.framework */,
9663F9301C7A744600AF0965 /* App */,
9663F92F1C7A744600AF0965 /* Products */,
);
......
......@@ -7,8 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
9692C9561CE53D35008C2766 /* Material.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9692C9551CE53D35008C2766 /* Material.framework */; };
9692C9571CE53D35008C2766 /* Material.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9692C9551CE53D35008C2766 /* Material.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
96F2F1BB1C97A4F800A5FE27 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96F2F1B51C97A4F800A5FE27 /* AppDelegate.swift */; };
96F2F1BC1C97A4F800A5FE27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F1B61C97A4F800A5FE27 /* Assets.xcassets */; };
96F2F1BD1C97A4F800A5FE27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F1B71C97A4F800A5FE27 /* LaunchScreen.storyboard */; };
......@@ -22,7 +20,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9692C9571CE53D35008C2766 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -30,7 +27,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9692C9551CE53D35008C2766 /* 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>"; };
96EFD7161C8F73C60063F49E /* NavigationBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NavigationBar.app; sourceTree = BUILT_PRODUCTS_DIR; };
96F2F1B51C97A4F800A5FE27 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
96F2F1B61C97A4F800A5FE27 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
......@@ -44,7 +40,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9692C9561CE53D35008C2766 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -54,7 +49,6 @@
96EFD70D1C8F73C60063F49E = {
isa = PBXGroup;
children = (
9692C9551CE53D35008C2766 /* Material.framework */,
96F2F1B41C97A4F800A5FE27 /* NavigationBar */,
96EFD7171C8F73C60063F49E /* Products */,
);
......
......@@ -7,6 +7,8 @@
objects = {
/* 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 */; };
96F2F1C81C97A52F00A5FE27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F1C21C97A52F00A5FE27 /* Assets.xcassets */; };
96F2F1C91C97A52F00A5FE27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F1C31C97A52F00A5FE27 /* LaunchScreen.storyboard */; };
......@@ -20,6 +22,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9692C9771CEA3430008C2766 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase 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; };
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>"; };
......@@ -40,6 +44,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9692C9761CEA3430008C2766 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -49,6 +54,7 @@
96D88C761C132C1800B91418 = {
isa = PBXGroup;
children = (
9692C9751CEA3430008C2766 /* Material.framework */,
96F2F1C01C97A52F00A5FE27 /* Toolbar */,
96D88C801C132C1800B91418 /* Products */,
);
......
......@@ -56,6 +56,8 @@ class ViewController: UIViewController {
private func prepareToolbar() {
toolbar = Toolbar()
view.addSubview(toolbar)
// Title label.
toolbar.titleLabel.text = "Material"
toolbar.titleLabel.textColor = MaterialColor.white
......@@ -63,7 +65,7 @@ class ViewController: UIViewController {
// Detail label.
toolbar.detailLabel.text = "Build Beautiful Software"
toolbar.detailLabel.textColor = MaterialColor.white
var image: UIImage? = MaterialIcon.cm.menu
// Menu button.
......@@ -93,7 +95,5 @@ class ViewController: UIViewController {
toolbar.backgroundColor = MaterialColor.blue.base
toolbar.leftControls = [menuButton]
toolbar.rightControls = [switchControl, searchButton]
view.addSubview(toolbar)
}
}
......@@ -7,6 +7,8 @@
objects = {
/* 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 */; };
96F2F2161C97AFC600A5FE27 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F20E1C97AFC600A5FE27 /* Assets.xcassets */; };
96F2F2171C97AFC600A5FE27 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96F2F20F1C97AFC600A5FE27 /* LaunchScreen.storyboard */; };
......@@ -21,6 +23,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
9692C97A1CEA34F7008C2766 /* Material.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -28,6 +31,7 @@
/* End PBXCopyFilesBuildPhase 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>"; };
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>"; };
......@@ -42,6 +46,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9692C9791CEA34F7008C2766 /* Material.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -64,6 +69,7 @@
9ABEC5081C15085400F6895E = {
isa = PBXGroup;
children = (
9692C9781CEA34F7008C2766 /* Material.framework */,
96F2F20C1C97AFC600A5FE27 /* Toolbar */,
9ABEC5121C15085400F6895E /* Products */,
);
......
......@@ -40,32 +40,18 @@ public class Toolbar : StatusBarView {
public override func layoutSubviews() {
super.layoutSubviews()
if willRenderView {
if let _: String = titleLabel.text {
if nil == titleLabel.superview {
contentView.addSubview(titleLabel)
}
if let _: String = detailLabel.text {
titleLabel.sizeToFit()
detailLabel.sizeToFit()
if let _: String = detailLabel.text {
if nil == detailLabel.superview {
contentView.addSubview(detailLabel)
}
titleLabel.sizeToFit()
detailLabel.sizeToFit()
let diff: CGFloat = (contentView.frame.height - titleLabel.frame.height - detailLabel.frame.height) / 2
titleLabel.frame.size.height += diff
titleLabel.frame.size.width = contentView.frame.width
detailLabel.frame.size.height += diff
detailLabel.frame.size.width = contentView.frame.width
detailLabel.frame.origin.y = titleLabel.frame.height
} else {
detailLabel.removeFromSuperview()
titleLabel.frame = contentView.bounds
}
let diff: CGFloat = (contentView.frame.height - titleLabel.frame.height - detailLabel.frame.height) / 2
titleLabel.frame.size.height += diff
titleLabel.frame.size.width = contentView.frame.width
detailLabel.frame.size.height += diff
detailLabel.frame.size.width = contentView.frame.width
detailLabel.frame.origin.y = titleLabel.frame.height
} else {
titleLabel.removeFromSuperview()
contentView.grid.reloadLayout()
titleLabel.frame = contentView.bounds
}
}
}
......@@ -88,6 +74,7 @@ public class Toolbar : StatusBarView {
titleLabel = UILabel()
titleLabel.font = RobotoFont.mediumWithSize(17)
titleLabel.textAlignment = .Left
contentView.addSubview(titleLabel)
}
/// Prepares the detailLabel.
......@@ -95,5 +82,6 @@ public class Toolbar : StatusBarView {
detailLabel = UILabel()
detailLabel.font = RobotoFont.regularWithSize(12)
detailLabel.textAlignment = .Left
contentView.addSubview(detailLabel)
}
}
\ No newline at end of file
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