Commit fd00b5e3 by Daniel Dahan

updated BottomNavigationBar color settings

parent 42e249cb
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_music_note_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_music_note_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_music_note_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -49,23 +49,23 @@ class ViewController: UIViewController {
/// Prepare bottomNavigationBar.
private func prepareBottomNavigationBar() {
bottomNavigationBar = BottomNavigationBar()
bottomNavigationBar.backgroundColor = MaterialColor.teal.base
bottomNavigationBar.backgroundColor = MaterialColor.grey.darken4
view.addSubview(bottomNavigationBar)
let item1: BottomNavigationBarItem = BottomNavigationBarItem(title: "Music", image: UIImage(named:"ic_music_note_white")?.imageWithRenderingMode(.AlwaysOriginal), selectedImage: UIImage(named:"ic_music_note_white"))
item1.setTitleColor(MaterialColor.white, forState: .Normal)
item1.setTitleColor(MaterialColor.white, forState: .Selected)
let item1: BottomNavigationBarItem = BottomNavigationBarItem(title: "Video", image: UIImage(named:"ic_videocam_white")?.imageWithRenderingMode(.AlwaysTemplate), selectedImage: UIImage(named:"ic_videocam_white"))
item1.setTitleColor(MaterialColor.grey.base, forState: .Normal)
item1.setTitleColor(MaterialColor.yellow.base, forState: .Selected)
let item2: BottomNavigationBarItem = BottomNavigationBarItem(title: "Music", image: UIImage(named:"ic_music_note_white")?.imageWithRenderingMode(.AlwaysOriginal), selectedImage: UIImage(named:"ic_music_note_white"))
item2.setTitleColor(MaterialColor.white, forState: .Normal)
item2.setTitleColor(MaterialColor.white, forState: .Selected)
let item2: BottomNavigationBarItem = BottomNavigationBarItem(title: "Photo", image: UIImage(named:"ic_photo_camera_white")?.imageWithRenderingMode(.AlwaysTemplate), selectedImage: UIImage(named:"ic_photo_camera_white"))
item2.setTitleColor(MaterialColor.grey.base, forState: .Normal)
item2.setTitleColor(MaterialColor.yellow.base, forState: .Selected)
let item3: BottomNavigationBarItem = BottomNavigationBarItem(title: "Music", image: UIImage(named:"ic_music_note_white"), selectedImage: UIImage(named:"ic_music_note_white"))
item3.setTitleColor(MaterialColor.blue.lighten3, forState: .Normal)
item3.setTitleColor(MaterialColor.white, forState: .Selected)
let item3: BottomNavigationBarItem = BottomNavigationBarItem(title: "Library", image: UIImage(named:"ic_photo_library_white")?.imageWithRenderingMode(.AlwaysTemplate), selectedImage: UIImage(named:"ic_photo_library_white"))
item3.setTitleColor(MaterialColor.grey.base, forState: .Normal)
item3.setTitleColor(MaterialColor.yellow.base, forState: .Selected)
bottomNavigationBar.setItems([item1, item2, item3], animated: true)
// bottomNavigationBar.tintColor = MaterialColor.white
bottomNavigationBar.tintColor = MaterialColor.yellow.base
}
}
......@@ -235,6 +235,11 @@ public class BottomNavigationBar : UITabBar {
if let v: UIView = superview {
frame = CGRectMake(0, v.bounds.height - 56, v.bounds.width, 56)
}
if MaterialDevice.landscape {
itemPositioning = .Centered
} else {
itemPositioning = .Fill
}
}
/**
......
......@@ -33,7 +33,7 @@ import UIKit
@IBDesignable
public class BottomNavigationBarItem : UITabBarItem {
/// Sets the color of the title color for a state.
public func setTitleColor(color: UIColor?, forState: UIControlState) {
setTitleTextAttributes([NSForegroundColorAttributeName: MaterialColor.white], forState: .Normal)
public func setTitleColor(color: UIColor, forState state: UIControlState) {
setTitleTextAttributes([NSForegroundColorAttributeName: color], forState: state)
}
}
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