Commit febee7ec by Daniel Dahan

updated rotation factor for Toolbar and SearchBar

parent 49a3a27a
......@@ -77,7 +77,7 @@ class AppSearchBarController: SearchBarController {
/// Prepares the searchBar.
private func prepareSearchBar() {
var image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate)
var image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton()
clearButton.pulseScale = false
......@@ -97,7 +97,7 @@ class AppSearchBarController: SearchBarController {
backButton.addTarget(self, action: "handleBackButton", forControlEvents: .TouchUpInside)
// More button.
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate)
image = MaterialIcon.moreHorizontal
let moreButton: FlatButton = FlatButton()
moreButton.pulseScale = false
moreButton.pulseColor = MaterialColor.grey.darken4
......
......@@ -202,7 +202,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel)
image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate)
image = MaterialIcon.moreVertical
let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
......@@ -299,7 +299,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel)
image = UIImage(named: "ic_more_vert_white")?.imageWithRenderingMode(.AlwaysTemplate)
image = MaterialIcon.moreVertical
let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
......@@ -408,7 +408,7 @@ class ViewController: UIViewController {
titleLabel.backgroundColor = MaterialColor.clear
contentView.addSubview(titleLabel)
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate)
image = MaterialIcon.moreHorizontal
let moreButton: FlatButton = FlatButton()
moreButton.contentEdgeInsetsPreset = .None
moreButton.pulseColor = MaterialColor.blueGrey.darken4
......
......@@ -80,12 +80,12 @@ class ViewController: UIViewController {
if fabMenu.opened {
fabMenu.close()
image = UIImage(named: "ic_add_white")
image = MaterialIcon.add
} else {
fabMenu.open() { (v: UIView) in
(v as? MaterialButton)?.pulse()
}
image = UIImage(named: "ic_close_white")
image = MaterialIcon.close
}
// 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 {
/// Prepare toolbar.
private func prepareSearchBar() {
var image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate)
var image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton()
clearButton.pulseScale = false
......@@ -64,7 +64,7 @@ class ViewController: UIViewController {
clearButton.setImage(image, forState: .Highlighted)
// Back button.
image = UIImage(named: "ic_arrow_back_white")?.imageWithRenderingMode(.AlwaysTemplate)
image = MaterialIcon.arrowBack
let backButton: FlatButton = FlatButton()
backButton.pulseScale = false
backButton.pulseColor = MaterialColor.blueGrey.darken4
......@@ -76,7 +76,7 @@ class ViewController: UIViewController {
let switchControl: MaterialSwitch = MaterialSwitch(state: .Off, style: .Default, size: .Small)
// More button.
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate)
image = MaterialIcon.moreHorizontal
let moreButton: FlatButton = FlatButton()
moreButton.pulseScale = false
moreButton.pulseColor = MaterialColor.blueGrey.darken4
......
......@@ -76,10 +76,10 @@ class AppSearchBarController: SearchBarController {
/// Prepares the searchBar.
private func prepareSearchBar() {
var image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate)
var image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = nil
// clearButton.pulseColor = nil
clearButton.pulseScale = false
clearButton.tintColor = MaterialColor.blueGrey.darken4
clearButton.setImage(image, forState: .Normal)
......@@ -87,9 +87,9 @@ class AppSearchBarController: SearchBarController {
clearButton.addTarget(self, action: "handleYellowButton", forControlEvents: .TouchUpInside)
// Back button.
image = UIImage(named: "ic_arrow_back_white")?.imageWithRenderingMode(.AlwaysTemplate)
image = MaterialIcon.arrowBack
let backButton: FlatButton = FlatButton()
backButton.pulseColor = nil
// backButton.pulseColor = nil
backButton.pulseScale = false
backButton.tintColor = MaterialColor.blueGrey.darken4
backButton.setImage(image, forState: .Normal)
......@@ -97,9 +97,9 @@ class AppSearchBarController: SearchBarController {
backButton.addTarget(self, action: "handleBlueButton", forControlEvents: .TouchUpInside)
// More button.
image = UIImage(named: "ic_more_horiz_white")?.imageWithRenderingMode(.AlwaysTemplate)
image = MaterialIcon.moreHorizontal
let moreButton: FlatButton = FlatButton()
moreButton.pulseColor = nil
// moreButton.pulseColor = nil
moreButton.pulseScale = false
moreButton.tintColor = MaterialColor.blueGrey.darken4
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 {
textField.titleLabelColor = MaterialColor.grey.base
textField.titleLabelActiveColor = MaterialColor.blue.accent3
let image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate)
let image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.grey.base
......@@ -102,7 +102,7 @@ class ViewController: UIViewController, TextFieldDelegate {
textField.detailLabelActiveColor = MaterialColor.red.accent3
// 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()
clearButton.pulseColor = MaterialColor.grey.base
......
......@@ -68,7 +68,7 @@ class ViewController: UIViewController {
detailLabel.textColor = MaterialColor.white
detailLabel.font = RobotoFont.regular
var image = UIImage(named: "ic_menu_white")
var image: UIImage? = MaterialIcon.menu
// Menu button.
let menuButton: FlatButton = FlatButton()
......
......@@ -91,7 +91,7 @@ class AppToolbarController: ToolbarController {
// detailLabel.font = RobotoFont.regular
// toolbar.detailLabel = detailLabel
var image = UIImage(named: "ic_menu_white")
var image: UIImage? = MaterialIcon.menu
// Menu button.
let menuButton: FlatButton = FlatButton()
......
......@@ -67,7 +67,7 @@ class ViewController: UIViewController, TextFieldDelegate {
nameField.titleLabelColor = MaterialColor.grey.base
nameField.titleLabelActiveColor = MaterialColor.blue.accent3
let image = UIImage(named: "ic_close_white")?.imageWithRenderingMode(.AlwaysTemplate)
let image: UIImage? = MaterialIcon.close
let clearButton: FlatButton = FlatButton()
clearButton.pulseColor = MaterialColor.grey.base
......@@ -103,7 +103,7 @@ class ViewController: UIViewController, TextFieldDelegate {
emailField.detailLabelActiveColor = MaterialColor.red.accent3
// 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()
clearButton.pulseColor = MaterialColor.grey.base
......
......@@ -94,7 +94,7 @@ class ViewController: UIViewController {
toolbar.detailLabel = detailLabel
// Menu button.
let img1: UIImage? = UIImage(named: "ic_menu_white")
let img1: UIImage? = MaterialIcon.menu
let btn1: FlatButton = FlatButton()
btn1.pulseScale = false
btn1.setImage(img1, forState: .Normal)
......
......@@ -12,7 +12,7 @@ Express your creativity with Material, an animation and graphics framework for G
- [x] Grid System For Complex UIs
- [x] Layout Library To Simplify AutoLayout
- [x] Base Material Layers & Material Views To Create New UI Components
- [x] Navigation Controllers
- [x] Navigation Controls
- [x] Material Buttons
- [x] Material Switch
- [x] Material Card Views
......@@ -91,6 +91,7 @@ Material is a growing project and will encounter changes throughout its developm
#### Collections
* MaterialCollectionViewCell
* [MaterialTableViewCell](#materialtableviewcell)
#### Cards
......@@ -98,17 +99,17 @@ Material is a growing project and will encounter changes throughout its developm
* [CardView](#cardview)
* [ImageCardView](#imagecardview)
#### Navigation
#### Navigation Controls
* [MenuView](#menuview)
* [MenuViewController](#menuviewcontroller)
* NavigationBar
* [Toolbar](#toolbar)
* NavigationController
* [Toolbar](#toolbar)
* [ToolbarController](#toolbarcontroller)
* [SearchBar](#searchbarview)
* [SearchBarController](#searchbarviewcontroller)
* [SideNavigationController](#sidenavigationviewcontroller)
* [SearchBar](#searchbar)
* [SearchBarController](#searchbarcontroller)
* [SideNavigationController](#sidenavigationcontroller)
#### Photo / Video Camera
......@@ -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)
#### 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.
......@@ -322,7 +323,7 @@ A ToolbarController manages UIViewControllers using a NavigationBar component.
![MaterialToolbarController](http://www.cosmicmind.io/MK/MaterialToolbarController.gif)
<a name="searchbarview"></a>
<a name="searchbar"></a>
#### 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.
......@@ -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)
<a href="#searchbarviewcontroller"></a>
<a href="#searchbarcontroller"></a>
#### SearchBarController
A SearchBarController manages UIViewControllers using a SearchBar component.
![MaterialSearchBarController](http://www.cosmicmind.io/MK/MaterialSearchBarController.gif)
<a href="#sidenavigationviewcontroller"></a>
<a href="#sidenavigationcontroller"></a>
#### SideNavigationController
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 {
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 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 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 {
}
}
/// Handles the rotation factor top inset.
internal var rotationFactor: CGFloat = 0
/// A convenience initializer.
public convenience init() {
self.init(frame: CGRectZero)
......@@ -75,12 +78,19 @@ public class StatusBarView : ControlView {
// General alignment.
if .iPhone == MaterialDevice.type && MaterialDevice.landscape {
contentInset.top = 0
if heightForStatusBar == rotationFactor {
contentInset.top -= rotationFactor
rotationFactor = 0
}
height = heightForLandscapeOrientation
} else {
contentInset.top = heightForStatusBar
if 0 == rotationFactor {
rotationFactor = heightForStatusBar
contentInset.top += rotationFactor
}
height = heightForPortraitOrientation
}
// We can call super now that we have a width.
super.layoutSubviews()
}
......@@ -99,8 +109,8 @@ public class StatusBarView : ControlView {
public override func prepareView() {
super.prepareView()
depth = .Depth1
spacingPreset = .Spacing2
// contentInset = UIEdgeInsetsMake(2, 2, 2, 2)
spacingPreset = .Spacing1
contentInset = UIEdgeInsetsMake(2, 2, 2, 2)
autoresizingMask = .FlexibleWidth
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