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
2be8f826
Commit
2be8f826
authored
Jun 12, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated NavigationDrawerController project
parent
85dae35e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
83 additions
and
36 deletions
+83
-36
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController.xcodeproj/project.pbxproj
+10
-0
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/AppDelegate.swift
+1
-1
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/AppRightViewController.swift
+44
-0
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/YellowViewController.swift
+13
-8
Sources/iOS/BarController.swift
+3
-3
Sources/iOS/MenuController.swift
+3
-3
Sources/iOS/NavigationDrawerController.swift
+9
-21
No files found.
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController.xcodeproj/project.pbxproj
View file @
2be8f826
...
...
@@ -7,6 +7,9 @@
objects
=
{
/* Begin PBXBuildFile section */
967A48071D0E0EA300B8CEB7
/* AppRightViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967A48061D0E0EA300B8CEB7
/* AppRightViewController.swift */
;
};
967A48091D0E127200B8CEB7
/* Material.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967A48081D0E127200B8CEB7
/* Material.framework */
;
};
967A480A1D0E127200B8CEB7
/* Material.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967A48081D0E127200B8CEB7
/* Material.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
96CB75011D0DFDBB0012D9F2
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96CB75001D0DFDBB0012D9F2
/* AppDelegate.swift */
;
};
96CB75031D0DFDBB0012D9F2
/* AppLeftViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96CB75021D0DFDBB0012D9F2
/* AppLeftViewController.swift */
;
};
96CB75081D0DFDBB0012D9F2
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96CB75071D0DFDBB0012D9F2
/* Assets.xcassets */
;
};
...
...
@@ -25,6 +28,7 @@
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
967A480A1D0E127200B8CEB7
/* Material.framework in Embed Frameworks */
,
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -32,6 +36,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
967A48061D0E0EA300B8CEB7
/* AppRightViewController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppRightViewController.swift
;
sourceTree
=
"<group>"
;
};
967A48081D0E127200B8CEB7
/* Material.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
name
=
Material.framework
;
path
=
"/Users/danieldahan/Library/Developer/Xcode/DerivedData/Material-dciwtavdzrmtrifplxfnouazaqvx/Build/Products/Debug-iphoneos/Material.framework"
;
sourceTree
=
"<absolute>"
;
};
96CB74FD1D0DFDBB0012D9F2
/* NavigationDrawerController.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
NavigationDrawerController.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
96CB75001D0DFDBB0012D9F2
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
96CB75021D0DFDBB0012D9F2
/* AppLeftViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppLeftViewController.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -50,6 +56,7 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
967A48091D0E127200B8CEB7
/* Material.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
@@ -59,6 +66,7 @@
96CB74F41D0DFDBB0012D9F2
=
{
isa
=
PBXGroup
;
children
=
(
967A48081D0E127200B8CEB7
/* Material.framework */
,
96CB74FF1D0DFDBB0012D9F2
/* NavigationDrawerController */
,
96CB74FE1D0DFDBB0012D9F2
/* Products */
,
);
...
...
@@ -77,6 +85,7 @@
children
=
(
96CB75001D0DFDBB0012D9F2
/* AppDelegate.swift */
,
96CB75021D0DFDBB0012D9F2
/* AppLeftViewController.swift */
,
967A48061D0E0EA300B8CEB7
/* AppRightViewController.swift */
,
96CB75121D0DFF6F0012D9F2
/* YellowViewController.swift */
,
96CB75141D0DFF840012D9F2
/* BlueViewController.swift */
,
96CB75161D0DFF9C0012D9F2
/* GreenViewController.swift */
,
...
...
@@ -165,6 +174,7 @@
96CB75191D0DFFAE0012D9F2
/* PurpleViewController.swift in Sources */
,
96CB75151D0DFF840012D9F2
/* BlueViewController.swift in Sources */
,
96CB75011D0DFDBB0012D9F2
/* AppDelegate.swift in Sources */
,
967A48071D0E0EA300B8CEB7
/* AppRightViewController.swift in Sources */
,
96CB751B1D0DFFC10012D9F2
/* OrangeViewController.swift in Sources */
,
96CB75171D0DFF9C0012D9F2
/* GreenViewController.swift in Sources */
,
);
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/AppDelegate.swift
View file @
2be8f826
...
...
@@ -38,7 +38,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func
application
(
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
NSObject
:
AnyObject
]?)
->
Bool
{
let
navigationController
:
NavigationController
=
NavigationController
(
rootViewController
:
YellowViewController
())
let
navigationDrawerController
:
NavigationDrawerController
=
NavigationDrawerController
(
rootViewController
:
navigationController
,
leftViewController
:
AppLeftViewController
())
let
navigationDrawerController
:
NavigationDrawerController
=
NavigationDrawerController
(
rootViewController
:
navigationController
,
leftViewController
:
AppLeftViewController
()
,
rightViewController
:
AppRightViewController
()
)
// navigationDrawerController.enabled = true
//
...
...
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/AppRightViewController.swift
0 → 100644
View file @
2be8f826
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of Material nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
import
Material
class
AppRightViewController
:
UIViewController
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepareView
()
}
/// General preparation statements.
private
func
prepareView
()
{
view
.
backgroundColor
=
MaterialColor
.
grey
.
darken4
}
}
Examples/Programmatic/NavigationDrawerController/NavigationDrawerController/YellowViewController.swift
View file @
2be8f826
...
...
@@ -38,8 +38,8 @@ class YellowViewController: UIViewController {
/// NavigationBar switch control.
private
var
switchControl
:
MaterialSwitch
!
/// NavigationBar
search
button.
private
var
search
Button
:
IconButton
!
/// NavigationBar
more
button.
private
var
more
Button
:
IconButton
!
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -60,6 +60,10 @@ class YellowViewController: UIViewController {
navigationDrawerController
?
.
openLeftView
()
}
internal
func
handleMoreButton
()
{
navigationDrawerController
?
.
openRightView
()
}
/// Prepares the view.
private
func
prepareView
()
{
view
.
backgroundColor
=
MaterialColor
.
yellow
.
base
...
...
@@ -82,11 +86,12 @@ class YellowViewController: UIViewController {
/// Prepares the searchButton.
private
func
prepareSearchButton
()
{
let
image
:
UIImage
?
=
MaterialIcon
.
cm
.
search
searchButton
=
IconButton
()
searchButton
.
pulseColor
=
MaterialColor
.
white
searchButton
.
setImage
(
image
,
forState
:
.
Normal
)
searchButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
let
image
:
UIImage
?
=
MaterialIcon
.
cm
.
moreVertical
moreButton
=
IconButton
()
moreButton
.
pulseColor
=
MaterialColor
.
white
moreButton
.
setImage
(
image
,
forState
:
.
Normal
)
moreButton
.
setImage
(
image
,
forState
:
.
Highlighted
)
moreButton
.
addTarget
(
self
,
action
:
#selector(
handleMoreButton
)
,
forControlEvents
:
.
TouchUpInside
)
}
/// Prepares the navigationItem.
...
...
@@ -96,7 +101,7 @@ class YellowViewController: UIViewController {
navigationItem
.
titleLabel
.
font
=
RobotoFont
.
mediumWithSize
(
20
)
navigationItem
.
leftControls
=
[
menuButton
]
navigationItem
.
rightControls
=
[
switchControl
,
search
Button
]
navigationItem
.
rightControls
=
[
switchControl
,
more
Button
]
}
/// Prepares the navigationBar.
...
...
Sources/iOS/BarController.swift
View file @
2be8f826
...
...
@@ -145,8 +145,6 @@ public class BarController : UIViewController {
/// A method that prepares the rootViewController.
private
func
prepareRootViewController
()
{
rootViewController
.
view
.
clipsToBounds
=
true
rootViewController
.
view
.
autoresizingMask
=
[
.
FlexibleWidth
,
.
FlexibleHeight
]
prepareViewControllerWithinContainer
(
rootViewController
,
container
:
view
)
}
...
...
@@ -161,9 +159,11 @@ public class BarController : UIViewController {
private
func
prepareViewControllerWithinContainer
(
viewController
:
UIViewController
?,
container
:
UIView
)
{
if
let
v
:
UIViewController
=
viewController
{
addChildViewController
(
v
)
v
.
didMoveToParentViewController
(
self
)
v
.
view
.
clipsToBounds
=
true
v
.
view
.
autoresizingMask
=
[
.
FlexibleWidth
,
.
FlexibleHeight
]
container
.
addSubview
(
v
.
view
)
container
.
sendSubviewToBack
(
v
.
view
)
v
.
didMoveToParentViewController
(
self
)
}
}
}
Sources/iOS/MenuController.swift
View file @
2be8f826
...
...
@@ -196,8 +196,6 @@ public class MenuController : UIViewController {
/// A method that prepares the rootViewController.
private
func
prepareRootViewController
()
{
rootViewController
.
view
.
clipsToBounds
=
true
rootViewController
.
view
.
autoresizingMask
=
[
.
FlexibleWidth
,
.
FlexibleHeight
]
prepareViewControllerWithinContainer
(
rootViewController
,
container
:
view
)
}
...
...
@@ -212,9 +210,11 @@ public class MenuController : UIViewController {
private
func
prepareViewControllerWithinContainer
(
viewController
:
UIViewController
?,
container
:
UIView
)
{
if
let
v
:
UIViewController
=
viewController
{
addChildViewController
(
v
)
v
.
didMoveToParentViewController
(
self
)
v
.
view
.
clipsToBounds
=
true
v
.
view
.
autoresizingMask
=
[
.
FlexibleWidth
,
.
FlexibleHeight
]
container
.
addSubview
(
v
.
view
)
container
.
sendSubviewToBack
(
v
.
view
)
v
.
didMoveToParentViewController
(
self
)
}
}
...
...
Sources/iOS/NavigationDrawerController.swift
View file @
2be8f826
...
...
@@ -400,13 +400,7 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
public
override
func
viewWillTransitionToSize
(
size
:
CGSize
,
withTransitionCoordinator
coordinator
:
UIViewControllerTransitionCoordinator
)
{
super
.
viewWillTransitionToSize
(
size
,
withTransitionCoordinator
:
coordinator
)
// Portrait will be Lanscape when this method is done.
if
MaterialDevice
.
isPortrait
&&
.
iPhone
==
MaterialDevice
.
type
{
hideStatusBar
()
}
else
{
showStatusBar
()
}
closeLeftView
()
closeLeftView
()
closeRightView
()
// Ensures the view is hidden.
...
...
@@ -725,7 +719,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
public
func
closeRightView
(
velocity
:
CGFloat
=
0
)
{
if
enabledRightView
{
if
let
v
:
MaterialView
=
rightView
{
showStatusBar
()
userInteractionEnabled
=
true
delegate
?
.
navigationDrawerWillClose
?(
self
,
position
:
.
Right
)
UIView
.
animateWithDuration
(
Double
(
0
==
velocity
?
animationDuration
:
fmax
(
0.1
,
fmin
(
1
,
Double
(
v
.
x
/
velocity
)))),
...
...
@@ -841,7 +834,7 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
let
a
:
CGFloat
=
1
-
(
view
.
bounds
.
width
-
v
.
position
.
x
)
/
v
.
width
rootViewController
.
view
.
alpha
=
0.5
<
a
&&
v
.
position
.
x
>=
v
.
width
/
2
?
a
:
0.5
if
translationX
<=
view
.
bounds
.
width
-
rightThreshold
{
if
translationX
<=
-
rightThreshold
{
hideStatusBar
()
}
...
...
@@ -914,17 +907,12 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
/// A method that prepares the rootViewController.
private
func
prepareRootViewController
()
{
rootViewController
.
view
.
clipsToBounds
=
true
rootViewController
.
view
.
frame
=
view
.
bounds
rootViewController
.
view
.
autoresizingMask
=
[
.
FlexibleWidth
,
.
FlexibleHeight
]
prepareViewControllerWithinContainer
(
rootViewController
,
container
:
view
)
}
/// A method that prepares the leftViewController.
private
func
prepareLeftViewController
()
{
if
let
v
:
MaterialView
=
leftView
{
leftViewController
?
.
view
.
clipsToBounds
=
true
leftViewController
?
.
view
.
autoresizingMask
=
[
.
FlexibleWidth
,
.
FlexibleHeight
]
prepareViewControllerWithinContainer
(
leftViewController
,
container
:
v
)
prepareLeftViewGestures
()
}
...
...
@@ -933,8 +921,6 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
/// A method that prepares the rightViewController.
private
func
prepareRightViewController
()
{
if
let
v
:
MaterialView
=
rightView
{
rightViewController
?
.
view
.
clipsToBounds
=
true
leftViewController
?
.
view
.
autoresizingMask
=
[
.
FlexibleWidth
,
.
FlexibleHeight
]
prepareViewControllerWithinContainer
(
rightViewController
,
container
:
v
)
prepareRightViewGestures
()
}
...
...
@@ -991,9 +977,11 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
private
func
prepareViewControllerWithinContainer
(
viewController
:
UIViewController
?,
container
:
UIView
)
{
if
let
v
:
UIViewController
=
viewController
{
addChildViewController
(
v
)
v
.
didMoveToParentViewController
(
self
)
v
.
view
.
clipsToBounds
=
true
v
.
view
.
autoresizingMask
=
[
.
FlexibleWidth
,
.
FlexibleHeight
]
container
.
addSubview
(
v
.
view
)
container
.
sendSubviewToBack
(
v
.
view
)
v
.
didMoveToParentViewController
(
self
)
}
}
...
...
@@ -1098,8 +1086,8 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
willHideStatusBar
=
false
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
self
?
.
statusBarHidden
=
false
self
?
.
statusBarHidden
=
false
self
?
.
setNeedsStatusBarAppearanceUpdate
()
})
delegate
?
.
navigationDrawerStatusBarHiddenState
?(
self
,
hidden
:
false
)
}
...
...
@@ -1112,8 +1100,8 @@ public class NavigationDrawerController : UIViewController, UIGestureRecognizerD
if
!
statusBarHidden
{
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
self
?
.
statusBarHidden
=
true
self
?
.
statusBarHidden
=
true
self
?
.
setNeedsStatusBarAppearanceUpdate
()
})
delegate
?
.
navigationDrawerStatusBarHiddenState
?(
self
,
hidden
:
true
)
}
...
...
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