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
012d5b80
Commit
012d5b80
authored
Jun 08, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #428 from mohpor/development
Draft for fixing statusbar hide/unhide issue
parents
aa42d5fb
046a7b47
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
Sources/iOS/NavigationBar.swift
+20
-3
Sources/iOS/SideNavigationController.swift
+4
-2
No files found.
Sources/iOS/NavigationBar.swift
View file @
012d5b80
...
@@ -285,6 +285,21 @@ public class NavigationBar : UINavigationBar {
...
@@ -285,6 +285,21 @@ public class NavigationBar : UINavigationBar {
self
.
init
(
frame
:
CGRectZero
)
self
.
init
(
frame
:
CGRectZero
)
}
}
private
func
statusbarOffset
()
->
CGFloat
{
var
result
:
CGFloat
=
0
switch
MaterialDevice
.
type
{
case
.
iPad
:
result
=
MaterialDevice
.
statusBarHidden
?
20
:
0
case
.
iPhone
:
result
=
MaterialDevice
.
isPortrait
&&
MaterialDevice
.
statusBarHidden
?
20
:
0
case
.
TV
:
break
case
.
Unspecified
:
break
}
return
result
;
}
public
override
func
intrinsicContentSize
()
->
CGSize
{
public
override
func
intrinsicContentSize
()
->
CGSize
{
switch
navigationBarStyle
{
switch
navigationBarStyle
{
case
.
Tiny
:
case
.
Tiny
:
...
@@ -297,7 +312,9 @@ public class NavigationBar : UINavigationBar {
...
@@ -297,7 +312,9 @@ public class NavigationBar : UINavigationBar {
}
}
public
override
func
sizeThatFits
(
size
:
CGSize
)
->
CGSize
{
public
override
func
sizeThatFits
(
size
:
CGSize
)
->
CGSize
{
return
intrinsicContentSize
()
var
result
:
CGSize
=
intrinsicContentSize
()
result
.
height
+=
statusbarOffset
()
return
result
}
}
public
override
func
layoutSubviews
()
{
public
override
func
layoutSubviews
()
{
...
@@ -328,8 +345,8 @@ public class NavigationBar : UINavigationBar {
...
@@ -328,8 +345,8 @@ public class NavigationBar : UINavigationBar {
if
let
contentView
:
UIView
=
prepareContentView
(
item
)
{
if
let
contentView
:
UIView
=
prepareContentView
(
item
)
{
if
let
g
:
Int
=
Int
(
width
/
gridFactor
)
{
if
let
g
:
Int
=
Int
(
width
/
gridFactor
)
{
let
columns
:
Int
=
g
+
1
let
columns
:
Int
=
g
+
1
titleView
.
frame
.
origin
=
CGPoint
Zero
titleView
.
frame
.
origin
=
CGPoint
(
x
:
0
,
y
:
statusbarOffset
())
titleView
.
frame
.
size
=
intrinsicContentSize
()
titleView
.
frame
.
size
=
intrinsicContentSize
()
titleView
.
grid
.
views
=
[]
titleView
.
grid
.
views
=
[]
titleView
.
grid
.
axis
.
columns
=
columns
titleView
.
grid
.
axis
.
columns
=
columns
...
...
Sources/iOS/SideNavigationController.swift
View file @
012d5b80
...
@@ -1098,9 +1098,10 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
...
@@ -1098,9 +1098,10 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
willHideStatusBar
=
false
willHideStatusBar
=
false
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
self
?
.
statusBarHidden
=
false
self
?
.
statusBarHidden
=
false
})
})
self
.
setNeedsStatusBarAppearanceUpdate
()
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
false
)
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
false
)
}
}
}
}
...
@@ -1112,9 +1113,10 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
...
@@ -1112,9 +1113,10 @@ public class SideNavigationController : UIViewController, UIGestureRecognizerDel
if
!
statusBarHidden
{
if
!
statusBarHidden
{
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
UIView
.
animateWithDuration
(
NSTimeInterval
(
UINavigationControllerHideShowBarDuration
),
animations
:
{
[
weak
self
]
in
animations
:
{
[
weak
self
]
in
self
?
.
setNeedsStatusBarAppearanceUpdate
()
self
?
.
statusBarHidden
=
true
self
?
.
statusBarHidden
=
true
})
})
self
.
setNeedsStatusBarAppearanceUpdate
()
delegate
?
.
sideNavigationStatusBarHiddenState
?(
self
,
hidden
:
true
)
delegate
?
.
sideNavigationStatusBarHiddenState
?(
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