Commit d5393fa0 by Daniel Dahan

working Storyboard example for BottomNavigationBar

parent cf752159
......@@ -14,6 +14,19 @@
96162C171CA6F2BC00E3A235 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 96162C151CA6F2BC00E3A235 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
96162C211CA7037600E3A235 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
96162C091CA6F2BC00E3A235 /* BottomNavigationBar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BottomNavigationBar.app; sourceTree = BUILT_PRODUCTS_DIR; };
96162C0C1CA6F2BC00E3A235 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
......@@ -74,6 +87,7 @@
96162C051CA6F2BC00E3A235 /* Sources */,
96162C061CA6F2BC00E3A235 /* Frameworks */,
96162C071CA6F2BC00E3A235 /* Resources */,
96162C211CA7037600E3A235 /* Embed Frameworks */,
);
buildRules = (
);
......@@ -286,6 +300,7 @@
96162C1D1CA6F2BC00E3A235 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
......
......@@ -17,31 +17,28 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tabBar contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sMP-AS-Zl9" customClass="BottomNavigationBar" customModule="Material">
<tabBar contentMode="scaleToFill" misplaced="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sMP-AS-Zl9" customClass="BottomNavigationBar" customModule="Material">
<rect key="frame" x="0.0" y="551" width="600" height="49"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="56" id="k7G-L7-HGU"/>
<constraint firstAttribute="height" constant="56" id="2xR-RQ-MBH"/>
</constraints>
<items>
<tabBarItem title="Video" id="BkO-Yq-m1c" customClass="BottomNavigationBarItem" customModule="Material"/>
<tabBarItem title="Photo" id="vsG-AI-jYq" customClass="BottomNavigationBarItem" customModule="Material"/>
<tabBarItem title="Library" id="3fX-Ej-FRM" customClass="BottomNavigationBarItem" customModule="Material"/>
</items>
<color key="barTintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="backgroundColor">
<color key="value" red="0.0" green="0.56862745100000001" blue="0.99607843139999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="height">
<real key="value" value="56"/>
<color key="value" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</tabBar>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="sMP-AS-Zl9" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="Kyz-7k-p0J"/>
<constraint firstItem="sMP-AS-Zl9" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="8LA-GW-uqq"/>
<constraint firstItem="sMP-AS-Zl9" firstAttribute="bottom" secondItem="wfy-db-euE" secondAttribute="top" id="S7K-32-n4f"/>
<constraint firstAttribute="trailing" secondItem="sMP-AS-Zl9" secondAttribute="trailing" id="oIw-fR-Dot"/>
</constraints>
</view>
<connections>
......
......@@ -41,8 +41,19 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
videoItem.image = MaterialIcon.videocam
videoItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
videoItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
photoItem.image = MaterialIcon.photoCamera
photoItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
photoItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
libraryItem.image = MaterialIcon.photoLibrary
libraryItem.setTitleColor(MaterialColor.grey.base, forState: .Normal)
libraryItem.setTitleColor(MaterialColor.teal.base, forState: .Selected)
bottomNavigationBar.tintColor = MaterialColor.teal.base // Sets the image color when highlighted.
bottomNavigationBar.selectedItem = videoItem
}
}
......
......@@ -126,7 +126,7 @@ public class BottomNavigationBar : UITabBar {
}
/// A property that accesses the backing layer's shadowOffset.
public var shadowOffset: CGSize {
@IBInspectable public var shadowOffset: CGSize {
get {
return layer.shadowOffset
}
......
......@@ -40,6 +40,22 @@ public struct MaterialColor {
// black
public static let black: UIColor = UIColor.blackColor()
// dark text
public struct darkText {
public static let primary: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.87)
public static let secondary: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.54)
public static let others: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.38)
public static let dividers: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.12)
}
// light text
public struct lightText {
public static let primary: UIColor = UIColor.whiteColor()
public static let secondary: UIColor = UIColor.whiteColor().colorWithAlphaComponent(0.7)
public static let others: UIColor = UIColor.whiteColor().colorWithAlphaComponent(0.5)
public static let dividers: UIColor = UIColor.whiteColor().colorWithAlphaComponent(0.12)
}
// red
public struct red {
public static let lighten5: UIColor = UIColor(red: 255/255, green: 235/255, blue: 238/255, alpha: 1)
......@@ -371,20 +387,4 @@ public struct MaterialColor {
public static let darken3: UIColor = UIColor(red: 55/255, green: 71/255, blue: 79/255, alpha: 1)
public static let darken4: UIColor = UIColor(red: 38/255, green: 50/255, blue: 56/255, alpha: 1)
}
// dark text
public struct darkText {
public static let primary: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.87)
public static let secondary: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.54)
public static let others: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.38)
public static let dividers: UIColor = UIColor.blackColor().colorWithAlphaComponent(0.12)
}
// light text
public struct lightText {
public static let primary: UIColor = UIColor.whiteColor()
public static let secondary: UIColor = UIColor.whiteColor().colorWithAlphaComponent(0.7)
public static let others: UIColor = UIColor.whiteColor().colorWithAlphaComponent(0.5)
public static let dividers: UIColor = UIColor.whiteColor().colorWithAlphaComponent(0.12)
}
}
......@@ -164,7 +164,7 @@ public class NavigationBar : UINavigationBar {
}
/// A property that accesses the backing layer's shadowOffset.
public var shadowOffset: CGSize {
@IBInspectable public var shadowOffset: CGSize {
get {
return layer.shadowOffset
}
......
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