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
39244b57
Commit
39244b57
authored
Mar 06, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Plain Diff
working NavigationBar and App example
parents
c46110ca
f7441424
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
43 deletions
+20
-43
Examples/Programmatic/App/App/AppDelegate.swift
+1
-1
Examples/Programmatic/App/App/AppLeftViewController.swift
+1
-1
Examples/Programmatic/App/App/FeedViewController.swift
+8
-19
Examples/Programmatic/App/App/InboxViewController.swift
+2
-11
Sources/CardView.swift
+3
-3
Sources/ImageCardView.swift
+3
-3
Sources/MaterialColor.swift
+1
-1
Sources/NavigationBar.swift
+1
-4
No files found.
Examples/Programmatic/App/App/AppDelegate.swift
View file @
39244b57
...
@@ -40,7 +40,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
...
@@ -40,7 +40,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Override point for customization after application launch.
// Override point for customization after application launch.
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
window
=
UIWindow
(
frame
:
UIScreen
.
mainScreen
()
.
bounds
)
// window!.rootViewController = SideNavigationViewController(mainViewController: AppMenuViewController(mainViewController: AppNavigationBarViewController(mainViewController: InboxViewController())), leftViewController: AppLeftViewController(), rightViewController: AppRightViewController())
// window!.rootViewController = SideNavigationViewController(mainViewController: AppMenuViewController(mainViewController: AppNavigationBarViewController(mainViewController: InboxViewController())), leftViewController: AppLeftViewController(), rightViewController: AppRightViewController())
window
!.
rootViewController
=
SideNavigationViewController
(
mainViewController
:
NavigationController
(
rootViewController
:
FeedViewController
(
)),
leftViewController
:
AppLeftViewController
())
window
!.
rootViewController
=
SideNavigationViewController
(
mainViewController
:
AppMenuViewController
(
mainViewController
:
NavigationController
(
rootViewController
:
FeedViewController
()
)),
leftViewController
:
AppLeftViewController
())
window
!.
makeKeyAndVisible
()
window
!.
makeKeyAndVisible
()
return
true
return
true
}
}
...
...
Examples/Programmatic/App/App/AppLeftViewController.swift
View file @
39244b57
...
@@ -161,7 +161,7 @@ extension AppLeftViewController: UITableViewDelegate {
...
@@ -161,7 +161,7 @@ extension AppLeftViewController: UITableViewDelegate {
func
tableView
(
tableView
:
UITableView
,
willSelectRowAtIndexPath
indexPath
:
NSIndexPath
)
->
NSIndexPath
?
{
func
tableView
(
tableView
:
UITableView
,
willSelectRowAtIndexPath
indexPath
:
NSIndexPath
)
->
NSIndexPath
?
{
let
item
:
Item
=
items
[
indexPath
.
row
]
let
item
:
Item
=
items
[
indexPath
.
row
]
print
(
sideNavigationViewController
?
.
mainViewController
.
navigationController
)
/**
/**
An example of loading a new UIViewController in the AppNavigationBarViewController
An example of loading a new UIViewController in the AppNavigationBarViewController
if the UIViewController is not already loaded. This is a bit of a tricky example, as
if the UIViewController is not already loaded. This is a bit of a tricky example, as
...
...
Examples/Programmatic/App/App/FeedViewController.swift
View file @
39244b57
...
@@ -47,26 +47,14 @@ class FeedViewController: UIViewController {
...
@@ -47,26 +47,14 @@ class FeedViewController: UIViewController {
prepareCollectionView
()
prepareCollectionView
()
}
}
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
collectionView
.
reloadData
()
}
override
func
viewWillAppear
(
animated
:
Bool
)
{
override
func
viewWillAppear
(
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
super
.
viewWillAppear
(
animated
)
navigationItem
.
title
=
"Feed"
navigationController
?
.
navigationBar
.
leftControls
=
[
menuButton
]
sideNavigationViewController
?
.
enabled
=
true
sideNavigationViewController
?
.
enabled
=
true
}
}
override
func
viewDidAppear
(
animated
:
Bool
)
{
override
func
viewWillTransitionToSize
(
size
:
CGSize
,
withTransitionCoordinator
coordinator
:
UIViewControllerTransitionCoordinator
)
{
super
.
viewDidAppear
(
animated
)
super
.
viewWillTransitionToSize
(
size
,
withTransitionCoordinator
:
coordinator
)
collectionView
.
reloadData
()
// Handles when the page is being panned left to right.
navigationItem
.
title
=
"Feed"
navigationController
?
.
navigationBar
.
leftControls
=
[
menuButton
]
}
}
internal
func
handleMenuButton
()
{
internal
func
handleMenuButton
()
{
...
@@ -84,12 +72,12 @@ class FeedViewController: UIViewController {
...
@@ -84,12 +72,12 @@ class FeedViewController: UIViewController {
prepareMenuButton
()
prepareMenuButton
()
prepareSearchButton
()
prepareSearchButton
()
navigationItem
.
title
=
"Feed"
navigationController
?
.
navigationBar
.
leftControls
=
[
menuButton
]
navigationController
?
.
navigationBar
.
rightControls
=
[
searchButton
]
navigationController
?
.
navigationBar
.
statusBarStyle
=
.
LightContent
navigationController
?
.
navigationBar
.
statusBarStyle
=
.
LightContent
navigationController
?
.
navigationBar
.
tintColor
=
MaterialColor
.
white
navigationController
?
.
navigationBar
.
tintColor
=
MaterialColor
.
white
navigationController
?
.
navigationBar
.
backgroundColor
=
MaterialColor
.
blue
.
base
navigationController
?
.
navigationBar
.
backgroundColor
=
MaterialColor
.
blue
.
base
navigationController
?
.
navigationBar
.
backButton
.
pulseColor
=
MaterialColor
.
white
navigationController
?
.
navigationBar
.
rightControls
=
[
searchButton
]
}
}
/// Prepares the menuButton.
/// Prepares the menuButton.
...
@@ -213,8 +201,9 @@ extension FeedViewController: MaterialCollectionViewDataSource {
...
@@ -213,8 +201,9 @@ extension FeedViewController: MaterialCollectionViewDataSource {
cardView
!.
divider
=
false
cardView
!.
divider
=
false
cardView
!.
depth
=
.
None
cardView
!.
depth
=
.
None
cardView
!.
contentInsetPreset
=
.
Square3
cardView
!.
contentInsetPreset
=
.
Square3
cardView
!.
contentInset
.
bottom
/=
2
cardView
!.
cornerRadiusPreset
=
.
None
cardView
!.
cornerRadiusPreset
=
.
None
cardView
!.
rightButtonsInset
Preset
=
.
None
cardView
!.
rightButtonsInset
.
right
=
-
8
let
titleLabel
:
UILabel
=
UILabel
()
let
titleLabel
:
UILabel
=
UILabel
()
titleLabel
.
textColor
=
MaterialColor
.
grey
.
darken4
titleLabel
.
textColor
=
MaterialColor
.
grey
.
darken4
...
...
Examples/Programmatic/App/App/InboxViewController.swift
View file @
39244b57
...
@@ -53,20 +53,9 @@ class InboxViewController: UIViewController {
...
@@ -53,20 +53,9 @@ class InboxViewController: UIViewController {
override
func
viewWillAppear
(
animated
:
Bool
)
{
override
func
viewWillAppear
(
animated
:
Bool
)
{
super
.
viewWillAppear
(
animated
)
super
.
viewWillAppear
(
animated
)
navigationItem
.
title
=
"Messages"
navigationController
?
.
navigationBar
.
topItem
?
.
title
=
""
navigationController
?
.
navigationBar
.
leftControls
=
[]
sideNavigationViewController
?
.
enabled
=
false
sideNavigationViewController
?
.
enabled
=
false
}
}
override
func
viewDidAppear
(
animated
:
Bool
)
{
super
.
viewDidAppear
(
animated
)
navigationItem
.
title
=
"Messages"
navigationController
?
.
navigationBar
.
leftControls
=
[]
}
/**
/**
Handles the search button click, which opens the
Handles the search button click, which opens the
SideNavigationViewController.
SideNavigationViewController.
...
@@ -78,6 +67,8 @@ class InboxViewController: UIViewController {
...
@@ -78,6 +67,8 @@ class InboxViewController: UIViewController {
/// Prepares view.
/// Prepares view.
private
func
prepareView
()
{
private
func
prepareView
()
{
view
.
backgroundColor
=
MaterialColor
.
white
view
.
backgroundColor
=
MaterialColor
.
white
navigationItem
.
title
=
"Inbox"
}
}
/// Prepares the items Array.
/// Prepares the items Array.
...
...
Sources/CardView.swift
View file @
39244b57
...
@@ -75,7 +75,7 @@ public class CardView : MaterialPulseView {
...
@@ -75,7 +75,7 @@ public class CardView : MaterialPulseView {
/**
/**
:name: contentInsets
:name: contentInsets
*/
*/
public
var
contentInsetPreset
:
MaterialEdgeInset
=
.
None
{
public
var
contentInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
didSet
{
didSet
{
contentInset
=
MaterialEdgeInsetToValue
(
contentInsetPreset
)
contentInset
=
MaterialEdgeInsetToValue
(
contentInsetPreset
)
}
}
...
@@ -93,7 +93,7 @@ public class CardView : MaterialPulseView {
...
@@ -93,7 +93,7 @@ public class CardView : MaterialPulseView {
/**
/**
:name: titleLabelInsets
:name: titleLabelInsets
*/
*/
public
var
titleLabelInsetPreset
:
MaterialEdgeInset
=
.
None
{
public
var
titleLabelInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
didSet
{
didSet
{
titleLabelInset
=
MaterialEdgeInsetToValue
(
titleLabelInsetPreset
)
titleLabelInset
=
MaterialEdgeInsetToValue
(
titleLabelInsetPreset
)
}
}
...
@@ -121,7 +121,7 @@ public class CardView : MaterialPulseView {
...
@@ -121,7 +121,7 @@ public class CardView : MaterialPulseView {
/**
/**
:name: detailViewInsets
:name: detailViewInsets
*/
*/
public
var
detailViewInsetPreset
:
MaterialEdgeInset
=
.
None
{
public
var
detailViewInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
didSet
{
didSet
{
detailViewInset
=
MaterialEdgeInsetToValue
(
detailViewInsetPreset
)
detailViewInset
=
MaterialEdgeInsetToValue
(
detailViewInsetPreset
)
}
}
...
...
Sources/ImageCardView.swift
View file @
39244b57
...
@@ -166,7 +166,7 @@ public class ImageCardView : MaterialPulseView {
...
@@ -166,7 +166,7 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: contentInsets
:name: contentInsets
*/
*/
public
var
contentInsetPreset
:
MaterialEdgeInset
=
.
None
{
public
var
contentInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
didSet
{
didSet
{
contentInset
=
MaterialEdgeInsetToValue
(
contentInsetPreset
)
contentInset
=
MaterialEdgeInsetToValue
(
contentInsetPreset
)
}
}
...
@@ -184,7 +184,7 @@ public class ImageCardView : MaterialPulseView {
...
@@ -184,7 +184,7 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: titleLabelInsets
:name: titleLabelInsets
*/
*/
public
var
titleLabelInsetPreset
:
MaterialEdgeInset
=
.
None
{
public
var
titleLabelInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
didSet
{
didSet
{
titleLabelInset
=
MaterialEdgeInsetToValue
(
titleLabelInsetPreset
)
titleLabelInset
=
MaterialEdgeInsetToValue
(
titleLabelInsetPreset
)
}
}
...
@@ -212,7 +212,7 @@ public class ImageCardView : MaterialPulseView {
...
@@ -212,7 +212,7 @@ public class ImageCardView : MaterialPulseView {
/**
/**
:name: detailViewInsets
:name: detailViewInsets
*/
*/
public
var
detailViewInsetPreset
:
MaterialEdgeInset
=
.
None
{
public
var
detailViewInsetPreset
:
MaterialEdgeInset
=
.
Square2
{
didSet
{
didSet
{
detailViewInset
=
MaterialEdgeInsetToValue
(
detailViewInsetPreset
)
detailViewInset
=
MaterialEdgeInsetToValue
(
detailViewInsetPreset
)
}
}
...
...
Sources/MaterialColor.swift
View file @
39244b57
...
@@ -169,7 +169,7 @@ public struct MaterialColor {
...
@@ -169,7 +169,7 @@ public struct MaterialColor {
// cyan
// cyan
public
struct
cyan
{
public
struct
cyan
{
public
static
let
lighten5
:
UIColor
=
UIColor
(
red
:
224
/
255
,
green
:
247
/
255
,
blue
:
250
/
255
,
alpha
:
1
)
public
static
let
lighten5
:
UIColor
=
UIColor
(
red
:
224
/
255
,
green
:
247
/
255
,
blue
:
250
/
255
,
alpha
:
1
)
public
static
let
lighten4
:
UIColor
=
UIColor
(
red
:
1
1
78
/
255
,
green
:
235
/
255
,
blue
:
242
/
255
,
alpha
:
1
)
public
static
let
lighten4
:
UIColor
=
UIColor
(
red
:
178
/
255
,
green
:
235
/
255
,
blue
:
242
/
255
,
alpha
:
1
)
public
static
let
lighten3
:
UIColor
=
UIColor
(
red
:
128
/
255
,
green
:
222
/
255
,
blue
:
2343
/
255
,
alpha
:
1
)
public
static
let
lighten3
:
UIColor
=
UIColor
(
red
:
128
/
255
,
green
:
222
/
255
,
blue
:
2343
/
255
,
alpha
:
1
)
public
static
let
lighten2
:
UIColor
=
UIColor
(
red
:
77
/
255
,
green
:
208
/
255
,
blue
:
225
/
255
,
alpha
:
1
)
public
static
let
lighten2
:
UIColor
=
UIColor
(
red
:
77
/
255
,
green
:
208
/
255
,
blue
:
225
/
255
,
alpha
:
1
)
public
static
let
lighten1
:
UIColor
=
UIColor
(
red
:
38
/
255
,
green
:
198
/
255
,
blue
:
218
/
255
,
alpha
:
1
)
public
static
let
lighten1
:
UIColor
=
UIColor
(
red
:
38
/
255
,
green
:
198
/
255
,
blue
:
218
/
255
,
alpha
:
1
)
...
...
Sources/NavigationBar.swift
View file @
39244b57
...
@@ -373,9 +373,6 @@ public class NavigationBar : UINavigationBar {
...
@@ -373,9 +373,6 @@ public class NavigationBar : UINavigationBar {
public
override
func
layoutSubviews
()
{
public
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
super
.
layoutSubviews
()
leftControls
=
leftControls
rightControls
=
rightControls
if
nil
!=
backItem
&&
nil
!=
topItem
{
if
nil
!=
backItem
&&
nil
!=
topItem
{
backButton
.
setImage
(
backButtonImage
,
forState
:
.
Normal
)
backButton
.
setImage
(
backButtonImage
,
forState
:
.
Normal
)
backButton
.
setImage
(
backButtonImage
,
forState
:
.
Highlighted
)
backButton
.
setImage
(
backButtonImage
,
forState
:
.
Highlighted
)
...
@@ -467,8 +464,8 @@ public class NavigationBarControls {
...
@@ -467,8 +464,8 @@ public class NavigationBarControls {
public
init
()
{
public
init
()
{
backButton
=
FlatButton
()
backButton
=
FlatButton
()
backButton
.
pulseColor
=
nil
backButton
.
pulseScale
=
false
backButton
.
pulseScale
=
false
backButton
.
pulseColor
=
MaterialColor
.
white
}
}
}
}
...
...
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