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