Commit febee7ec by Daniel Dahan

updated rotation factor for Toolbar and SearchBar

parent 49a3a27a
...@@ -77,7 +77,7 @@ class AppSearchBarController: SearchBarController { ...@@ -77,7 +77,7 @@ class AppSearchBarController: SearchBarController {
/// Prepares the searchBar. /// Prepares the searchBar.
private func prepareSearchBar() { private func prepareSearchBar() {
var image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate) var image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton() let clearButton: FlatButton = FlatButton()
clearButton.pulseScale = false clearButton.pulseScale = false
...@@ -97,7 +97,7 @@ class AppSearchBarController: SearchBarController { ...@@ -97,7 +97,7 @@ class AppSearchBarController: SearchBarController {
backButton.addTarget(self, action: "handleBackButton", forControlEvents: .TouchUpInside) backButton.addTarget(self, action: "handleBackButton", forControlEvents: .TouchUpInside)
// More button. // More button.
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate) image = MaterialIcon.moreHorizontal
let moreButton: FlatButton = FlatButton() let moreButton: FlatButton = FlatButton()
moreButton.pulseScale = false moreButton.pulseScale = false
moreButton.pulseColor = MaterialColor.grey.darken4 moreButton.pulseColor = MaterialColor.grey.darken4
......
...@@ -202,7 +202,7 @@ class ViewController: UIViewController { ...@@ -202,7 +202,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate) image = MaterialIcon.moreVertical
let moreButton: FlatButton = FlatButton() let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4 moreButton.pulseColor = MaterialColor.blueGrey.darken4
...@@ -299,7 +299,7 @@ class ViewController: UIViewController { ...@@ -299,7 +299,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate) image = MaterialIcon.moreVertical
let moreButton: FlatButton = FlatButton() let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4 moreButton.pulseColor = MaterialColor.blueGrey.darken4
...@@ -408,7 +408,7 @@ class ViewController: UIViewController { ...@@ -408,7 +408,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate) image = MaterialIcon.moreHorizontal
let moreButton: FlatButton = FlatButton() let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4 moreButton.pulseColor = MaterialColor.blueGrey.darken4
......
...@@ -80,12 +80,12 @@ class ViewController: UIViewController { ...@@ -80,12 +80,12 @@ class ViewController: UIViewController {
if fabMenu.opened { if fabMenu.opened {
fabMenu.close() fabMenu.close()
image = UIImage(named: "ic_add_white") image = MaterialIcon.add
} else { } else {
fabMenu.open() { (v: UIView) in fabMenu.open() { (v: UIView) in
(v as? MaterialButton)?.pulse() (v as? MaterialButton)?.pulse()
} }
image = UIImage(named: "ic_close_white") image = MaterialIcon.close
} }
// Add a nice rotation animation to the base button. // Add a nice rotation animation to the base button.
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_close_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_close_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_close_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -54,7 +54,7 @@ class ViewController: UIViewController { ...@@ -54,7 +54,7 @@ class ViewController: UIViewController {
/// Prepare toolbar. /// Prepare toolbar.
private func prepareSearchBar() { private func prepareSearchBar() {
var image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate) var image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton() let clearButton: FlatButton = FlatButton()
clearButton.pulseScale = false clearButton.pulseScale = false
...@@ -64,7 +64,7 @@ class ViewController: UIViewController { ...@@ -64,7 +64,7 @@ class ViewController: UIViewController {
clearButton.setImage(image, forState: .Highlighted) clearButton.setImage(image, forState: .Highlighted)
// Back button. // Back button.
image = UIImage(named: "ic_arrow_back_white")?.imageWithRenderingMode(.AlwaysTemplate) image = MaterialIcon.arrowBack
let backButton: FlatButton = FlatButton() let backButton: FlatButton = FlatButton()
backButton.pulseScale = false backButton.pulseScale = false
backButton.pulseColor = MaterialColor.blueGrey.darken4 backButton.pulseColor = MaterialColor.blueGrey.darken4
...@@ -76,7 +76,7 @@ class ViewController: UIViewController { ...@@ -76,7 +76,7 @@ class ViewController: UIViewController {
let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .Default, size: .Small) let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .Default, size: .Small)
// More button. // More button.
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate) image = MaterialIcon.moreHorizontal
let moreButton: FlatButton = FlatButton() let moreButton: FlatButton = FlatButton()
moreButton.pulseScale = false moreButton.pulseScale = false
moreButton.pulseColor = MaterialColor.blueGrey.darken4 moreButton.pulseColor = MaterialColor.blueGrey.darken4
......
...@@ -76,10 +76,10 @@ class AppSearchBarController: SearchBarController { ...@@ -76,10 +76,10 @@ class AppSearchBarController: SearchBarController {
/// Prepares the searchBar. /// Prepares the searchBar.
private func prepareSearchBar() { private func prepareSearchBar() {
var image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate) var image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton() let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = nil // clearButton.pulseColor = nil
clearButton.pulseScale = false clearButton.pulseScale = false
clearButton.tintColor = MaterialColor.blueGrey.darken4 clearButton.tintColor = MaterialColor.blueGrey.darken4
clearButton.setImage(image, forState: .Normal) clearButton.setImage(image, forState: .Normal)
...@@ -87,9 +87,9 @@ class AppSearchBarController: SearchBarController { ...@@ -87,9 +87,9 @@ class AppSearchBarController: SearchBarController {
clearButton.addTarget(self, action: "handleYellowButton", forControlEvents: .TouchUpInside) clearButton.addTarget(self, action: "handleYellowButton", forControlEvents: .TouchUpInside)
// Back button. // Back button.
image = UIImage(named: "ic_arrow_back_white")?.imageWithRenderingMode(.AlwaysTemplate) image = MaterialIcon.arrowBack
let backButton: FlatButton = FlatButton() let backButton: FlatButton = FlatButton()
backButton.pulseColor = nil // backButton.pulseColor = nil
backButton.pulseScale = false backButton.pulseScale = false
backButton.tintColor = MaterialColor.blueGrey.darken4 backButton.tintColor = MaterialColor.blueGrey.darken4
backButton.setImage(image, forState: .Normal) backButton.setImage(image, forState: .Normal)
...@@ -97,9 +97,9 @@ class AppSearchBarController: SearchBarController { ...@@ -97,9 +97,9 @@ class AppSearchBarController: SearchBarController {
backButton.addTarget(self, action: "handleBlueButton", forControlEvents: .TouchUpInside) backButton.addTarget(self, action: "handleBlueButton", forControlEvents: .TouchUpInside)
// More button. // More button.
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate) image = MaterialIcon.moreHorizontal
let moreButton: FlatButton = FlatButton() let moreButton: FlatButton = FlatButton()
moreButton.pulseColor = nil // moreButton.pulseColor = nil
moreButton.pulseScale = false moreButton.pulseScale = false
moreButton.tintColor = MaterialColor.blueGrey.darken4 moreButton.tintColor = MaterialColor.blueGrey.darken4
moreButton.setImage(image, forState: .Normal) moreButton.setImage(image, forState: .Normal)
......
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_arrow_back_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_close_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_close_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_close_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white_2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "ic_more_horiz_white_3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -64,7 +64,7 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -64,7 +64,7 @@ class ViewController: UIViewController, TextFieldDelegate {
textField.titleLabelColor = MaterialColor.grey.base textField.titleLabelColor = MaterialColor.grey.base
textField.titleLabelActiveColor = MaterialColor.blue.accent3 textField.titleLabelActiveColor = MaterialColor.blue.accent3
let image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate) let image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton() let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.grey.base clearButton.pulseColor = MaterialColor.grey.base
...@@ -102,7 +102,7 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -102,7 +102,7 @@ class ViewController: UIViewController, TextFieldDelegate {
textField.detailLabelActiveColor = MaterialColor.red.accent3 textField.detailLabelActiveColor = MaterialColor.red.accent3
// textField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding. // textField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding.
let image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate) let image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton() let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.grey.base clearButton.pulseColor = MaterialColor.grey.base
......
...@@ -68,7 +68,7 @@ class ViewController: UIViewController { ...@@ -68,7 +68,7 @@ class ViewController: UIViewController {
detailLabel.textColor = MaterialColor.white detailLabel.textColor = MaterialColor.white
detailLabel.font = RobotoFont.regular detailLabel.font = RobotoFont.regular
var image = UIImage(named: "ic_menu_white") var image: UIImage? = MaterialIcon.menu
// Menu button. // Menu button.
let menuButton: FlatButton = FlatButton() let menuButton: FlatButton = FlatButton()
......
...@@ -91,7 +91,7 @@ class AppToolbarController: ToolbarController { ...@@ -91,7 +91,7 @@ class AppToolbarController: ToolbarController {
// detailLabel.font = RobotoFont.regular // detailLabel.font = RobotoFont.regular
// toolbar.detailLabel = detailLabel // toolbar.detailLabel = detailLabel
var image = UIImage(named: "ic_menu_white") var image: UIImage? = MaterialIcon.menu
// Menu button. // Menu button.
let menuButton: FlatButton = FlatButton() let menuButton: FlatButton = FlatButton()
......
...@@ -67,7 +67,7 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -67,7 +67,7 @@ class ViewController: UIViewController, TextFieldDelegate {
nameField.titleLabelColor = MaterialColor.grey.base nameField.titleLabelColor = MaterialColor.grey.base
nameField.titleLabelActiveColor = MaterialColor.blue.accent3 nameField.titleLabelActiveColor = MaterialColor.blue.accent3
let image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate) let image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton() let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.grey.base clearButton.pulseColor = MaterialColor.grey.base
...@@ -103,7 +103,7 @@ class ViewController: UIViewController, TextFieldDelegate { ...@@ -103,7 +103,7 @@ class ViewController: UIViewController, TextFieldDelegate {
emailField.detailLabelActiveColor = MaterialColor.red.accent3 emailField.detailLabelActiveColor = MaterialColor.red.accent3
// emailField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding. // emailField.detailLabelAutoHideEnabled = false // Uncomment this line to have manual hiding.
let image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate) let image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton() let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.grey.base clearButton.pulseColor = MaterialColor.grey.base
......
...@@ -94,7 +94,7 @@ class ViewController: UIViewController { ...@@ -94,7 +94,7 @@ class ViewController: UIViewController {
toolbar.detailLabel = detailLabel toolbar.detailLabel = detailLabel
// Menu button. // Menu button.
let img1: UIImage? = UIImage(named: "ic_menu_white") let img1: UIImage? = MaterialIcon.menu
let btn1: FlatButton = FlatButton() let btn1: FlatButton = FlatButton()
btn1.pulseScale = false btn1.pulseScale = false
btn1.setImage(img1, forState: .Normal) btn1.setImage(img1, forState: .Normal)
......
...@@ -12,7 +12,7 @@ Express your creativity with Material, an animation and graphics framework for G ...@@ -12,7 +12,7 @@ Express your creativity with Material, an animation and graphics framework for G
- [x] Grid System For Complex UIs - [x] Grid System For Complex UIs
- [x] Layout Library To Simplify AutoLayout - [x] Layout Library To Simplify AutoLayout
- [x] Base Material Layers & Material Views To Create New UI Components - [x] Base Material Layers & Material Views To Create New UI Components
- [x] Navigation Controllers - [x] Navigation Controls
- [x] Material Buttons - [x] Material Buttons
- [x] Material Switch - [x] Material Switch
- [x] Material Card Views - [x] Material Card Views
...@@ -91,6 +91,7 @@ Material is a growing project and will encounter changes throughout its developm ...@@ -91,6 +91,7 @@ Material is a growing project and will encounter changes throughout its developm
#### Collections #### Collections
* MaterialCollectionViewCell
* [MaterialTableViewCell](#materialtableviewcell) * [MaterialTableViewCell](#materialtableviewcell)
#### Cards #### Cards
...@@ -98,17 +99,17 @@ Material is a growing project and will encounter changes throughout its developm ...@@ -98,17 +99,17 @@ Material is a growing project and will encounter changes throughout its developm
* [CardView](#cardview) * [CardView](#cardview)
* [ImageCardView](#imagecardview) * [ImageCardView](#imagecardview)
#### Navigation #### Navigation Controls
* [MenuView](#menuview) * [MenuView](#menuview)
* [MenuViewController](#menuviewcontroller) * [MenuViewController](#menuviewcontroller)
* NavigationBar * NavigationBar
* [Toolbar](#toolbar)
* NavigationController * NavigationController
* [Toolbar](#toolbar)
* [ToolbarController](#toolbarcontroller) * [ToolbarController](#toolbarcontroller)
* [SearchBar](#searchbarview) * [SearchBar](#searchbar)
* [SearchBarController](#searchbarviewcontroller) * [SearchBarController](#searchbarcontroller)
* [SideNavigationController](#sidenavigationviewcontroller) * [SideNavigationController](#sidenavigationcontroller)
#### Photo / Video Camera #### Photo / Video Camera
...@@ -286,7 +287,7 @@ Remove elements, such as details to create a fresh look for your images. ...@@ -286,7 +287,7 @@ Remove elements, such as details to create a fresh look for your images.
[Learn More About ImageCardView](https://github.com/CosmicMind/Material/wiki/ImageCardView) [Learn More About ImageCardView](https://github.com/CosmicMind/Material/wiki/ImageCardView)
#### Navigation #### Navigation Controls
Navigation controls create smooth transitions between UIViewControllers. They may be used individually or stacked. Transitions are customizable and dimensions are flexible with auto management for both Portrait and Landscape modes. Navigation controls create smooth transitions between UIViewControllers. They may be used individually or stacked. Transitions are customizable and dimensions are flexible with auto management for both Portrait and Landscape modes.
...@@ -322,7 +323,7 @@ A ToolbarController manages UIViewControllers using a NavigationBar component. ...@@ -322,7 +323,7 @@ A ToolbarController manages UIViewControllers using a NavigationBar component.
![MaterialToolbarController](http://www.cosmicmind.io/MK/MaterialToolbarController.gif) ![MaterialToolbarController](http://www.cosmicmind.io/MK/MaterialToolbarController.gif)
<a name="searchbarview"></a> <a name="searchbar"></a>
#### SearchBar #### SearchBar
A SearchBar is a fully featured search bar that supports orientation changes, background images, title and detail labels, both left and right UIControl sets, and status bar settings. A SearchBar is a fully featured search bar that supports orientation changes, background images, title and detail labels, both left and right UIControl sets, and status bar settings.
...@@ -331,14 +332,14 @@ A SearchBar is a fully featured search bar that supports orientation changes, ba ...@@ -331,14 +332,14 @@ A SearchBar is a fully featured search bar that supports orientation changes, ba
[Learn More About SearchBar](https://github.com/CosmicMind/Material/wiki/SearchBar) [Learn More About SearchBar](https://github.com/CosmicMind/Material/wiki/SearchBar)
<a href="#searchbarviewcontroller"></a> <a href="#searchbarcontroller"></a>
#### SearchBarController #### SearchBarController
A SearchBarController manages UIViewControllers using a SearchBar component. A SearchBarController manages UIViewControllers using a SearchBar component.
![MaterialSearchBarController](http://www.cosmicmind.io/MK/MaterialSearchBarController.gif) ![MaterialSearchBarController](http://www.cosmicmind.io/MK/MaterialSearchBarController.gif)
<a href="#sidenavigationviewcontroller"></a> <a href="#sidenavigationcontroller"></a>
#### SideNavigationController #### SideNavigationController
A SideNavigationController manages UIViewControllers that are available as hidden drawers on the left and right of the view port. A SideNavigationController manages UIViewControllers that are available as hidden drawers on the left and right of the view port.
......
...@@ -37,6 +37,8 @@ public struct MaterialIcon { ...@@ -37,6 +37,8 @@ public struct MaterialIcon {
public static let clear: UIImage? = UIImage(named: "ic_close_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate) public static let clear: UIImage? = UIImage(named: "ic_close_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let close: UIImage? = UIImage(named: "ic_close_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate) public static let close: UIImage? = UIImage(named: "ic_close_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let menu: UIImage? = UIImage(named: "ic_menu_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate) public static let menu: UIImage? = UIImage(named: "ic_menu_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let moreHorizontal: UIImage? = UIImage(named: "ic_more_horiz_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let moreVertical: UIImage? = UIImage(named: "ic_more_vert_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let search: UIImage? = UIImage(named: "ic_search_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate) public static let search: UIImage? = UIImage(named: "ic_search_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
public static let share: UIImage? = UIImage(named: "ic_share_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate) public static let share: UIImage? = UIImage(named: "ic_share_white", inBundle: NSBundle(identifier: "io.cosmicmind.Material"), compatibleWithTraitCollection: nil)?.imageWithRenderingMode(.AlwaysTemplate)
} }
...@@ -50,6 +50,9 @@ public class StatusBarView : ControlView { ...@@ -50,6 +50,9 @@ 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)
...@@ -75,12 +78,19 @@ public class StatusBarView : ControlView { ...@@ -75,12 +78,19 @@ public class StatusBarView : ControlView {
// General alignment. // General alignment.
if .iPhone == MaterialDevice.type && MaterialDevice.landscape { if .iPhone == MaterialDevice.type && MaterialDevice.landscape {
contentInset.top = 0 if heightForStatusBar == rotationFactor {
contentInset.top -= rotationFactor
rotationFactor = 0
}
height = heightForLandscapeOrientation height = heightForLandscapeOrientation
} else { } else {
contentInset.top = heightForStatusBar if 0 == rotationFactor {
rotationFactor = heightForStatusBar
contentInset.top += rotationFactor
}
height = heightForPortraitOrientation height = heightForPortraitOrientation
} }
// We can call super now that we have a width. // We can call super now that we have a width.
super.layoutSubviews() super.layoutSubviews()
} }
...@@ -99,8 +109,8 @@ public class StatusBarView : ControlView { ...@@ -99,8 +109,8 @@ public class StatusBarView : ControlView {
public override func prepareView() { public override func prepareView() {
super.prepareView() super.prepareView()
depth = .Depth1 depth = .Depth1
spacingPreset = .Spacing2 spacingPreset = .Spacing1
// contentInset = UIEdgeInsetsMake(2, 2, 2, 2) contentInset = UIEdgeInsetsMake(2, 2, 2, 2)
autoresizingMask = .FlexibleWidth autoresizingMask = .FlexibleWidth
shadowPathAutoSizeEnabled = false shadowPathAutoSizeEnabled = false
} }
......
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