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
341a3dc1
Commit
341a3dc1
authored
Oct 29, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed iOS 11 layout issues for NavigationController.
parent
4d5f53a3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
32 deletions
+59
-32
CHANGELOG.md
+1
-0
Sources/iOS/Grid.swift
+3
-4
Sources/iOS/NavigationBar.swift
+50
-23
Sources/iOS/NavigationController.swift
+2
-2
Sources/iOS/PulseAnimation.swift
+3
-3
No files found.
CHANGELOG.md
View file @
341a3dc1
## 2.12.11
*
Fixed iPhoneX topLayoutGuide constraints not properly being set for StatusBarController types.
*
Fixed iOS 11 layout issues for NavigationController.
*
[
pr-945
](
https://github.com/CosmicMind/Material/pull/945
)
: iPhoneX update for TabBar bottom line alignment.
## 2.12.10
...
...
Sources/iOS/Grid.swift
View file @
341a3dc1
...
...
@@ -266,19 +266,18 @@ public struct Grid {
}
}
/// A memory reference to the Grid instance for UIView extensions.
fileprivate
var
GridKey
:
UInt8
=
0
fileprivate
var
AssociatedInstanceKey
:
UInt8
=
0
extension
UIView
{
/// Grid reference.
public
var
grid
:
Grid
{
get
{
return
AssociatedObject
.
get
(
base
:
self
,
key
:
&
Grid
Key
)
{
return
AssociatedObject
.
get
(
base
:
self
,
key
:
&
AssociatedInstance
Key
)
{
return
Grid
(
context
:
self
)
}
}
set
(
value
)
{
AssociatedObject
.
set
(
base
:
self
,
key
:
&
Grid
Key
,
value
:
value
)
AssociatedObject
.
set
(
base
:
self
,
key
:
&
AssociatedInstance
Key
,
value
:
value
)
}
}
...
...
Sources/iOS/NavigationBar.swift
View file @
341a3dc1
...
...
@@ -36,6 +36,12 @@ open class NavigationBar: UINavigationBar {
return
0
<
bounds
.
width
&&
0
<
bounds
.
height
&&
nil
!=
superview
}
/// Detail UILabel when in landscape for iOS 11.
fileprivate
var
toolbarToText
:
[
Toolbar
:
String
?]?
/// PulseAnimation for different views.
fileprivate
var
viewToPulseAnimation
:
[
UIView
:
PulseAnimation
]?
open
override
var
intrinsicContentSize
:
CGSize
{
return
CGSize
(
width
:
bounds
.
width
,
height
:
bounds
.
height
)
}
...
...
@@ -154,9 +160,14 @@ open class NavigationBar: UINavigationBar {
isTranslucent
=
false
depthPreset
=
.
depth1
contentScaleFactor
=
Screen
.
scale
backButtonImage
=
Icon
.
cm
.
arrowBack
contentEdgeInsetsPreset
=
.
square1
interimSpacePreset
=
.
interimSpace3
backButtonImage
=
Icon
.
cm
.
arrowBack
if
#available(iOS 11, *)
{
toolbarToText
=
[:]
viewToPulseAnimation
=
[:]
}
let
image
=
UIImage
()
shadowImage
=
image
...
...
@@ -175,35 +186,51 @@ internal extension NavigationBar {
return
}
item
.
toolbar
.
backgroundColor
=
.
clear
item
.
titleView
=
item
.
toolbar
guard
let
v
=
item
.
titleView
as?
Toolbar
else
{
return
}
let
toolbar
=
item
.
toolbar
toolbar
.
backgroundColor
=
.
clear
toolbar
.
interimSpace
=
interimSpace
toolbar
.
contentEdgeInsets
=
contentEdgeInsets
if
#available(iOS 11
.0
, *)
{
let
h
=
CGFloat
(
heightPreset
.
rawValue
)
frame
=
CGRect
(
x
:
frame
.
origin
.
x
,
y
:
20
,
width
:
frame
.
size
.
width
,
height
:
h
)
if
#available(iOS 11, *)
{
if
Application
.
shouldStatusBarBeHidden
{
toolbar
.
contentEdgeInsetsPreset
=
.
none
for
subview
in
subviews
{
var
stringFromClass
=
NSStringFromClass
(
subview
.
classForCoder
)
if
stringFromClass
.
contains
(
"BarBackground"
)
{
subview
.
frame
=
CGRect
(
x
:
0
,
y
:
0
,
width
:
frame
.
width
,
height
:
h
)
for
v
in
toolbar
.
leftViews
+
toolbar
.
rightViews
{
guard
var
b
=
v
as?
Pulseable
else
{
continue
}
guard
.
none
!=
b
.
pulseAnimation
else
{
continue
}
viewToPulseAnimation
?[
v
]
=
b
.
pulseAnimation
b
.
pulseAnimation
=
.
none
}
stringFromClass
=
NSStringFromClass
(
subview
.
classForCoder
)
if
stringFromClass
.
contains
(
"BarContent"
)
{
subview
.
frame
=
CGRect
(
x
:
subview
.
frame
.
origin
.
x
,
y
:
0
,
width
:
subview
.
frame
.
width
,
height
:
h
)
if
nil
!=
toolbar
.
detailLabel
.
text
{
toolbarToText
?[
toolbar
]
=
toolbar
.
detailLabel
.
text
toolbar
.
detailLabel
.
text
=
nil
}
}
else
if
nil
!=
toolbarToText
?[
toolbar
]
{
toolbar
.
detailLabel
.
text
=
toolbarToText
?[
toolbar
]
??
nil
toolbarToText
?[
toolbar
]
=
nil
for
v
in
toolbar
.
leftViews
+
toolbar
.
rightViews
{
guard
var
b
=
v
as?
Pulseable
else
{
continue
}
guard
let
a
=
viewToPulseAnimation
?[
v
]
else
{
continue
}
b
.
pulseAnimation
=
a
}
}
v
.
frame
=
frame
}
else
{
v
.
frame
=
bounds
}
v
.
contentEdgeInsets
=
contentEdgeInsets
v
.
interimSpace
=
interimSpac
e
item
.
titleView
=
toolbar
item
.
titleView
!.
frame
=
fram
e
}
}
Sources/iOS/NavigationController.swift
View file @
341a3dc1
...
...
@@ -158,12 +158,12 @@ extension NavigationController: UINavigationBarDelegate {
item
.
backButton
.
image
=
v
.
backButtonImage
}
item
.
backButton
.
addTarget
(
self
,
action
:
#selector(
handle(backButton:)
)
,
for
:
.
touchUpInside
)
if
!
item
.
backButton
.
isHidden
{
item
.
leftViews
.
insert
(
item
.
backButton
,
at
:
0
)
}
item
.
backButton
.
addTarget
(
self
,
action
:
#selector(
handle(backButton:)
)
,
for
:
.
touchUpInside
)
item
.
hidesBackButton
=
false
item
.
setHidesBackButton
(
true
,
animated
:
false
)
...
...
Sources/iOS/PulseAnimation.swift
View file @
341a3dc1
...
...
@@ -120,8 +120,8 @@ public struct Pulse {
let
w
=
view
.
bounds
.
width
let
h
=
view
.
bounds
.
height
Motion
.
disable
(
{
[
n
=
.
center
==
animation
?
w
<
h
?
w
:
h
:
w
<
h
?
h
:
w
,
Motion
.
disable
{
[
n
=
w
<
h
?
w
:
h
,
bounds
=
layer
.
bounds
,
animation
=
animation
,
color
=
color
,
...
...
@@ -141,7 +141,7 @@ public struct Pulse {
pLayer
.
cornerRadius
=
n
/
2
pLayer
.
backgroundColor
=
color
.
withAlphaComponent
(
opacity
)
.
cgColor
pLayer
.
transform
=
CATransform3DMakeAffineTransform
(
CGAffineTransform
(
scaleX
:
0
,
y
:
0
))
}
)
}
bLayer
.
setValue
(
false
,
forKey
:
"animated"
)
...
...
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