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
0029c656
Commit
0029c656
authored
Nov 14, 2015
by
danieldahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated SideNav dimension resize when cell-phone status is on
parent
bfe9ed9f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
18 deletions
+14
-18
Source/SideNavigationViewController.swift
+14
-18
No files found.
Source/SideNavigationViewController.swift
View file @
0029c656
...
...
@@ -166,10 +166,10 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
public
override
func
viewWillLayoutSubviews
()
{
super
.
viewWillLayoutSubviews
()
layoutBackdropLayer
()
if
let
v
:
MaterialView
=
sideView
{
sideViewController
?
.
view
.
frame
=
v
.
bounds
sideViewController
?
.
view
.
center
=
CGPointMake
(
v
.
width
/
2
,
v
.
height
/
2
)
}
sideView
.
height
=
view
.
bounds
.
height
sideViewController
.
view
.
frame
.
size
.
width
=
sideView
.
width
sideViewController
.
view
.
frame
.
size
.
height
=
sideView
.
height
sideViewController
.
view
.
center
=
CGPointMake
(
sideView
.
width
/
2
,
sideView
.
height
/
2
)
}
/**
...
...
@@ -206,13 +206,10 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
:name: open
*/
public
func
open
(
velocity
:
CGFloat
=
0
)
{
let
w
:
CGFloat
=
sideView
.
width
let
h
:
CGFloat
=
sideView
.
height
let
d
:
Double
=
Double
(
0
==
velocity
?
animationDuration
:
fmax
(
0.1
,
fmin
(
1
,
Double
(
sideView
.
x
/
velocity
))))
toggleStatusBar
(
true
)
MaterialAnimation
.
animationWithDuration
(
d
,
animations
:
{
self
.
sideView
.
position
=
CGPointMake
(
w
/
2
,
h
/
2
)
MaterialAnimation
.
animationWithDuration
(
Double
(
0
==
velocity
?
animationDuration
:
fmax
(
0.1
,
fmin
(
1
,
Double
(
sideView
.
x
/
velocity
)))),
animations
:
{
self
.
sideView
.
position
=
CGPointMake
(
self
.
sideView
.
width
/
2
,
self
.
sideView
.
height
/
2
)
self
.
backdropLayer
.
hidden
=
false
})
{
self
.
userInteractionEnabled
=
false
...
...
@@ -223,13 +220,10 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
:name: close
*/
public
func
close
(
velocity
:
CGFloat
=
0
)
{
let
w
:
CGFloat
=
sideView
.
width
let
h
:
CGFloat
=
sideView
.
height
let
d
:
Double
=
Double
(
0
==
velocity
?
animationDuration
:
fmax
(
0.1
,
fmin
(
1
,
Double
(
sideView
.
x
/
velocity
))))
toggleStatusBar
(
false
)
MaterialAnimation
.
animationWithDuration
(
d
,
animations
:
{
self
.
sideView
.
position
=
CGPointMake
(
-
w
/
2
,
h
/
2
)
MaterialAnimation
.
animationWithDuration
(
Double
(
0
==
velocity
?
animationDuration
:
fmax
(
0.1
,
fmin
(
1
,
Double
(
sideView
.
x
/
velocity
)))),
animations
:
{
self
.
sideView
.
position
=
CGPointMake
(
-
self
.
sideView
.
width
/
2
,
self
.
sideView
.
height
/
2
)
self
.
backdropLayer
.
hidden
=
true
})
{
self
.
userInteractionEnabled
=
true
...
...
@@ -281,6 +275,8 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
//
internal
func
prepareMainView
()
{
prepareViewControllerWithinContainer
(
mainViewController
,
container
:
view
)
mainViewController
.
view
.
translatesAutoresizingMaskIntoConstraints
=
false
MaterialLayout
.
alignToParent
(
view
,
child
:
mainViewController
.
view
)
}
//
...
...
@@ -290,6 +286,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
// container
sideView
.
frame
=
CGRectMake
(
0
,
0
,
sideViewControllerWidth
,
view
.
frame
.
height
)
sideView
.
backgroundColor
=
MaterialColor
.
blue
.
accent3
sideView
.
autoresizesSubviews
=
true
view
.
addSubview
(
sideView
)
MaterialAnimation
.
animationDisabled
({
...
...
@@ -297,7 +294,7 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
self
.
sideView
.
zPosition
=
1000
})
prepareViewControllerWithinContainer
(
sideViewController
!
,
container
:
sideView
)
prepareViewControllerWithinContainer
(
sideViewController
,
container
:
sideView
)
// gestures
prepareGestures
()
...
...
@@ -422,7 +419,6 @@ public class SideNavigationViewController: UIViewController, UIGestureRecognizer
// :name: prepareViewControllerWithinContainer
//
private
func
prepareViewControllerWithinContainer
(
controller
:
UIViewController
,
container
:
UIView
)
{
controller
.
view
.
clipsToBounds
=
true
addChildViewController
(
controller
)
container
.
addSubview
(
controller
.
view
)
controller
.
didMoveToParentViewController
(
self
)
...
...
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