Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
d56c1135
Commit
d56c1135
authored
Mar 07, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adjusting NavigationBar alignment
parent
28bbe4cb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
228 additions
and
185 deletions
+228
-185
Examples/Programmatic/App/App.xcodeproj/project.pbxproj
+4
-4
Examples/Programmatic/App/App/AppNavigationController.swift
+0
-31
Examples/Programmatic/App/App/FeedViewController.swift
+34
-1
Examples/Programmatic/App/App/MessagesViewController.swift
+10
-0
Sources/Grid.swift
+1
-1
Sources/Menu.swift
+1
-1
Sources/MenuView.swift
+1
-1
Sources/NavigationBar.swift
+135
-145
Sources/NavigationController.swift
+42
-1
No files found.
Examples/Programmatic/App/App.xcodeproj/project.pbxproj
View file @
d56c1135
...
...
@@ -13,7 +13,7 @@
9663F9341C7A744600AF0965
/* SearchListViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9331C7A744600AF0965
/* SearchListViewController.swift */
;
};
9663F9391C7A744600AF0965
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9381C7A744600AF0965
/* Assets.xcassets */
;
};
9663F93C1C7A744600AF0965
/* LaunchScreen.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F93A1C7A744600AF0965
/* LaunchScreen.storyboard */
;
};
9663F9481C7A749400AF0965
/* AppNavigation
BarViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9471C7A749400AF0965
/* AppNavigationBarView
Controller.swift */
;
};
9663F9481C7A749400AF0965
/* AppNavigation
Controller.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9471C7A749400AF0965
/* AppNavigation
Controller.swift */
;
};
9663F94A1C7A74B500AF0965
/* AppSearchBarViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F9491C7A74B500AF0965
/* AppSearchBarViewController.swift */
;
};
9663F94C1C7A74C700AF0965
/* AppMenuViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F94B1C7A74C700AF0965
/* AppMenuViewController.swift */
;
};
9663F94E1C7A74EA00AF0965
/* AppLeftViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9663F94D1C7A74EA00AF0965
/* AppLeftViewController.swift */
;
};
...
...
@@ -45,7 +45,7 @@
9663F9381C7A744600AF0965
/* Assets.xcassets */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
folder.assetcatalog
;
path
=
Assets.xcassets
;
sourceTree
=
"<group>"
;
};
9663F93B1C7A744600AF0965
/* Base */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file.storyboard
;
name
=
Base
;
path
=
Base.lproj/LaunchScreen.storyboard
;
sourceTree
=
"<group>"
;
};
9663F93D1C7A744600AF0965
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
9663F9471C7A749400AF0965
/* AppNavigation
BarViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppNavigationBarView
Controller.swift
;
sourceTree
=
"<group>"
;
};
9663F9471C7A749400AF0965
/* AppNavigation
Controller.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppNavigation
Controller.swift
;
sourceTree
=
"<group>"
;
};
9663F9491C7A74B500AF0965
/* AppSearchBarViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppSearchBarViewController.swift
;
sourceTree
=
"<group>"
;
};
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>"
;
};
...
...
@@ -88,7 +88,7 @@
isa
=
PBXGroup
;
children
=
(
9663F9311C7A744600AF0965
/* AppDelegate.swift */
,
9663F9471C7A749400AF0965
/* AppNavigation
BarView
Controller.swift */
,
9663F9471C7A749400AF0965
/* AppNavigationController.swift */
,
9663F9491C7A74B500AF0965
/* AppSearchBarViewController.swift */
,
9663F94B1C7A74C700AF0965
/* AppMenuViewController.swift */
,
9663F94D1C7A74EA00AF0965
/* AppLeftViewController.swift */
,
...
...
@@ -179,7 +179,7 @@
9663F94A1C7A74B500AF0965
/* AppSearchBarViewController.swift in Sources */
,
96CC08881C7FEBD60034FF84
/* InboxViewController.swift in Sources */
,
9663F9501C7A74FC00AF0965
/* AppRightViewController.swift in Sources */
,
9663F9481C7A749400AF0965
/* AppNavigation
BarView
Controller.swift in Sources */
,
9663F9481C7A749400AF0965
/* AppNavigationController.swift in Sources */
,
9663F9341C7A744600AF0965
/* SearchListViewController.swift in Sources */
,
9663F94C1C7A74C700AF0965
/* AppMenuViewController.swift in Sources */
,
9663F9321C7A744600AF0965
/* AppDelegate.swift in Sources */
,
...
...
Examples/Programmatic/App/App/AppNavigation
BarView
Controller.swift
→
Examples/Programmatic/App/App/AppNavigationController.swift
View file @
d56c1135
...
...
@@ -37,45 +37,14 @@ import UIKit
import
Material
class
AppNavigationController
:
NavigationController
{
/// Menu button at the top left of the navigation bar.
private
lazy
var
menuButton
:
FlatButton
=
FlatButton
()
/// Search button at the top left of the navigation bar.
private
lazy
var
searchButton
:
FlatButton
=
FlatButton
()
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepareMenuButton
()
prepareSearchButton
()
navigationBar
.
leftControls
=
[
menuButton
]
navigationBar
.
rightControls
=
[
searchButton
]
navigationBar
.
statusBarStyle
=
.
LightContent
navigationBar
.
tintColor
=
MaterialColor
.
white
navigationBar
.
backgroundColor
=
MaterialColor
.
blue
.
base
}
/// Prepares the menuButton.
private
func
prepareMenuButton
()
{
let
image
:
UIImage
?
=
UIImage
(
named
:
"ic_menu_white"
)
menuButton
.
pulseScale
=
false
menuButton
.
pulseColor
=
MaterialColor
.
white
menuButton
.
setImage
(
image
,
forState
:
.
Normal
)
menuButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
menuButton
.
addTarget
(
self
,
action
:
"handleMenuButton"
,
forControlEvents
:
.
TouchUpInside
)
}
/// Prepares the searchButton.
private
func
prepareSearchButton
()
{
// Search button.
let
image
:
UIImage
?
=
UIImage
(
named
:
"ic_search_white"
)
searchButton
.
pulseScale
=
false
searchButton
.
pulseColor
=
MaterialColor
.
white
searchButton
.
setImage
(
image
,
forState
:
.
Normal
)
searchButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
searchButton
.
addTarget
(
self
,
action
:
"handleSearchButton"
,
forControlEvents
:
.
TouchUpInside
)
}
}
//class AppNavigationBarViewController: NavigationBarViewController {
...
...
Examples/Programmatic/App/App/FeedViewController.swift
View file @
d56c1135
...
...
@@ -32,12 +32,20 @@ import UIKit
import
Material
class
FeedViewController
:
UIViewController
{
/// Menu button at the top left of the navigation bar.
private
lazy
var
menuButton
:
FlatButton
=
FlatButton
()
/// Search button at the top left of the navigation bar.
private
lazy
var
searchButton
:
FlatButton
=
FlatButton
()
/// MaterialCollectionView.
private
lazy
var
collectionView
:
MaterialCollectionView
=
MaterialCollectionView
()
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepareView
()
prepareMenuButton
()
prepareSearchButton
()
prepareCollectionView
()
}
...
...
@@ -51,10 +59,12 @@ class FeedViewController: UIViewController {
collectionView
.
reloadData
()
}
/// Handler for menuButton.
internal
func
handleMenuButton
()
{
sideNavigationViewController
?
.
toggleLeftView
()
//
sideNavigationViewController?.toggleLeftView()
}
/// Handler for searchButton.
internal
func
handleSearchButton
()
{
print
(
"handled"
)
}
...
...
@@ -75,6 +85,29 @@ class FeedViewController: UIViewController {
navigationItem
.
titleLabel
=
titleLabel
navigationItem
.
detailLabel
=
detailLabel
navigationItem
.
leftControls
=
[
menuButton
]
navigationItem
.
rightControls
=
[
searchButton
]
}
/// Prepares the menuButton.
private
func
prepareMenuButton
()
{
let
image
:
UIImage
?
=
UIImage
(
named
:
"ic_menu_white"
)
menuButton
.
pulseScale
=
false
menuButton
.
pulseColor
=
MaterialColor
.
white
menuButton
.
setImage
(
image
,
forState
:
.
Normal
)
menuButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
menuButton
.
addTarget
(
self
,
action
:
"handleMenuButton"
,
forControlEvents
:
.
TouchUpInside
)
}
/// Prepares the searchButton.
private
func
prepareSearchButton
()
{
// Search button.
let
image
:
UIImage
?
=
UIImage
(
named
:
"ic_search_white"
)
searchButton
.
pulseScale
=
false
searchButton
.
pulseColor
=
MaterialColor
.
white
searchButton
.
setImage
(
image
,
forState
:
.
Normal
)
searchButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
searchButton
.
addTarget
(
self
,
action
:
"handleSearchButton"
,
forControlEvents
:
.
TouchUpInside
)
}
/// Prepares the collectionView
...
...
Examples/Programmatic/App/App/MessagesViewController.swift
View file @
d56c1135
...
...
@@ -80,6 +80,16 @@ class MessagesViewController: UIViewController {
navigationItem
.
titleLabel
=
titleLabel
navigationItem
.
detailLabel
=
detailLabel
let
image
:
UIImage
?
=
UIImage
(
named
:
"ic_share_white"
)?
.
imageWithRenderingMode
(
.
AlwaysTemplate
)
let
shareButton
:
FlatButton
=
FlatButton
()
shareButton
.
pulseScale
=
false
shareButton
.
pulseColor
=
MaterialColor
.
grey
.
base
shareButton
.
tintColor
=
MaterialColor
.
grey
.
base
shareButton
.
setImage
(
image
,
forState
:
.
Normal
)
shareButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
navigationItem
.
rightControls
=
[
shareButton
]
}
/// Prepares the items Array.
...
...
Sources/Grid.swift
View file @
d56c1135
/*
* Copyright (C) 2015 - 20
spacing
, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* Copyright (C) 2015 - 20
16
, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
...
...
Sources/Menu.swift
View file @
d56c1135
/*
* Copyright (C) 2015 - 20
spacing
, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* Copyright (C) 2015 - 20
16
, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
...
...
Sources/MenuView.swift
View file @
d56c1135
/*
* Copyright (C) 2015 - 20
spacing
, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* Copyright (C) 2015 - 20
16
, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
...
...
Sources/NavigationBar.swift
View file @
d56c1135
This diff is collapsed.
Click to expand it.
Sources/NavigationController.swift
View file @
d56c1135
...
...
@@ -31,6 +31,7 @@
import
UIKit
public
class
NavigationController
:
UINavigationController
,
UINavigationBarDelegate
{
public
private(set)
lazy
var
backButton
:
FlatButton
=
FlatButton
()
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
...
...
@@ -45,9 +46,49 @@ public class NavigationController : UINavigationController, UINavigationBarDeleg
setViewControllers
([
rootViewController
],
animated
:
false
)
}
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepareBackButton
()
interactivePopGestureRecognizer
?
.
delegate
=
nil
}
public
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
interactivePopGestureRecognizer
?
.
delegate
=
nil
navigationBar
.
layoutSubviews
()
}
public
override
func
viewDidAppear
(
animated
:
Bool
)
{
super
.
viewDidAppear
(
animated
)
if
let
v
:
UINavigationItem
=
navigationBar
.
topItem
{
v
.
title
=
""
(
navigationBar
as?
NavigationBar
)?
.
layoutNavigationItem
(
v
)
}
}
public
func
navigationBar
(
navigationBar
:
UINavigationBar
,
shouldPushItem
item
:
UINavigationItem
)
->
Bool
{
item
.
title
=
""
item
.
setHidesBackButton
(
true
,
animated
:
false
)
return
true
}
public
func
navigationBar
(
navigationBar
:
UINavigationBar
,
didPushItem
item
:
UINavigationItem
)
{
if
let
v
:
NavigationBar
=
navigationBar
as?
NavigationBar
{
item
.
leftControls
=
[
backButton
]
v
.
layoutNavigationItem
(
item
)
}
}
internal
func
handleBackButton
()
{
popViewControllerAnimated
(
true
)
}
private
func
prepareBackButton
()
{
if
let
v
:
NavigationBar
=
navigationBar
as?
NavigationBar
{
backButton
.
pulseScale
=
false
backButton
.
pulseColor
=
MaterialColor
.
white
backButton
.
setImage
(
v
.
backButtonImage
,
forState
:
.
Normal
)
backButton
.
setImage
(
v
.
backButtonImage
,
forState
:
.
Highlighted
)
backButton
.
addTarget
(
self
,
action
:
"handleBackButton"
,
forControlEvents
:
.
TouchUpInside
)
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment