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
c173989f
Unverified
Commit
c173989f
authored
Sep 02, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated alignment for navigation controller types
parent
c57e2d79
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
124 additions
and
114 deletions
+124
-114
Sources/iOS/ControlView.swift
+11
-21
Sources/iOS/Grid.swift
+1
-7
Sources/iOS/IconButton.swift
+0
-1
Sources/iOS/NavigationBar.swift
+38
-34
Sources/iOS/NavigationController.swift
+1
-1
Sources/iOS/NavigationItem.swift
+45
-25
Sources/iOS/PageTabBarController.swift
+2
-4
Sources/iOS/PhotoLibraryController.swift
+0
-1
Sources/iOS/RootController.swift
+3
-1
Sources/iOS/SearchBarController.swift
+2
-4
Sources/iOS/Snackbar.swift
+7
-4
Sources/iOS/Toolbar.swift
+12
-7
Sources/iOS/ToolbarController.swift
+2
-4
No files found.
Sources/iOS/ControlView.swift
View file @
c173989f
...
...
@@ -164,26 +164,21 @@ open class ControlView: View {
if
willRenderView
{
layoutIfNeeded
()
var
lc
=
0
var
rc
=
0
let
l
=
(
CGFloat
(
leftControls
.
count
)
*
interimSpace
)
let
r
=
(
CGFloat
(
rightControls
.
count
)
*
interimSpace
)
let
p
=
width
-
l
-
r
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
var
lc
=
0
var
rc
=
0
let
columns
=
Int
(
p
/
gridFactor
)
let
columns
=
Int
(
p
/
gridFactor
)
grid
.
deferred
=
true
grid
.
views
.
removeAll
()
grid
.
axis
.
columns
=
columns
for
v
in
leftControls
{
var
w
:
CGFloat
=
0
if
let
b
=
v
as?
UIButton
{
b
.
contentEdgeInsets
=
.
zero
b
.
sizeToFit
()
w
=
b
.
width
}
v
.
height
=
frame
.
size
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
v
.
grid
.
columns
=
Int
(
ceil
(
w
/
gridFactor
))
+
1
(
v
as?
UIButton
)?
.
contentEdgeInsets
=
.
zero
v
.
sizeToFit
()
v
.
grid
.
columns
=
Int
(
ceil
(
v
.
width
/
gridFactor
))
+
1
lc
+=
v
.
grid
.
columns
...
...
@@ -193,14 +188,9 @@ open class ControlView: View {
grid
.
views
.
append
(
contentView
)
for
v
in
rightControls
{
var
w
:
CGFloat
=
0
if
let
b
=
v
as?
UIButton
{
b
.
contentEdgeInsets
=
.
zero
b
.
sizeToFit
()
w
=
b
.
width
}
v
.
height
=
frame
.
size
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
v
.
grid
.
columns
=
Int
(
ceil
(
w
/
gridFactor
))
+
1
(
v
as?
UIButton
)?
.
contentEdgeInsets
=
.
zero
v
.
sizeToFit
()
v
.
grid
.
columns
=
Int
(
ceil
(
v
.
width
/
gridFactor
))
+
1
rc
+=
v
.
grid
.
columns
...
...
@@ -220,6 +210,7 @@ open class ControlView: View {
}
grid
.
deferred
=
false
grid
.
reload
()
}
}
...
...
@@ -232,7 +223,7 @@ open class ControlView: View {
*/
open
override
func
prepareView
()
{
super
.
prepareView
()
interimSpacePreset
=
.
interimSpace
1
interimSpacePreset
=
.
interimSpace
3
contentEdgeInsetsPreset
=
.
square1
autoresizingMask
=
.
flexibleWidth
prepareContentView
()
...
...
@@ -242,6 +233,5 @@ open class ControlView: View {
private
func
prepareContentView
()
{
contentView
=
View
()
contentView
.
backgroundColor
=
nil
addSubview
(
contentView
)
}
}
Sources/iOS/Grid.swift
View file @
c173989f
...
...
@@ -108,13 +108,7 @@ public class GridOffset {
public
class
Grid
{
/// Defer the calculation.
public
var
deferred
=
false
{
didSet
{
if
!
deferred
{
reload
()
}
}
}
public
var
deferred
=
false
/// Context view.
internal
weak
var
context
:
UIView
?
...
...
Sources/iOS/IconButton.swift
View file @
c173989f
...
...
@@ -41,6 +41,5 @@ open class IconButton: Button {
open
override
func
prepareView
()
{
super
.
prepareView
()
pulseAnimation
=
.
center
shapePreset
=
.
circle
}
}
Sources/iOS/NavigationBar.swift
View file @
c173989f
...
...
@@ -190,35 +190,32 @@ open class NavigationBar: UINavigationBar {
- Parameter item: A UINavigationItem to layout.
*/
internal
func
layoutNavigationItem
(
item
:
UINavigationItem
)
{
if
willRenderView
{
prepareItem
(
item
:
item
)
let
titleView
=
prepareTitleView
(
item
:
item
)
if
willRenderView
{
prepareItem
(
item
:
item
)
let
titleView
=
prepareTitleView
(
item
:
item
)
let
contentView
=
prepareContentView
(
item
:
item
)
titleView
.
frame
.
origin
=
.
zero
titleView
.
frame
.
size
=
intrinsicContentSize
var
lc
=
0
var
rc
=
0
let
l
=
(
CGFloat
(
item
.
leftControls
.
count
)
*
interimSpace
)
let
r
=
(
CGFloat
(
item
.
rightControls
.
count
)
*
interimSpace
)
let
p
=
width
-
l
-
r
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
let
columns
=
Int
(
p
/
gridFactor
)
titleView
.
frame
.
origin
=
.
zero
titleView
.
frame
.
size
=
intrinsicContentSize
titleView
.
grid
.
deferred
=
true
titleView
.
grid
.
views
.
removeAll
()
titleView
.
grid
.
axis
.
columns
=
columns
contentView
.
grid
.
columns
=
columns
for
v
in
item
.
leftControls
{
var
w
:
CGFloat
=
0
if
let
b
=
v
as?
UIButton
{
b
.
contentEdgeInsets
=
.
zero
b
.
sizeToFit
()
w
=
b
.
width
}
v
.
height
=
frame
.
size
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
v
.
grid
.
columns
=
Int
(
ceil
(
w
/
gridFactor
))
+
1
(
v
as?
UIButton
)?
.
contentEdgeInsets
=
.
zero
v
.
sizeToFit
()
v
.
grid
.
columns
=
Int
(
ceil
(
v
.
width
/
gridFactor
))
+
1
contentView
.
grid
.
columns
-
=
v
.
grid
.
columns
lc
+
=
v
.
grid
.
columns
titleView
.
grid
.
views
.
append
(
v
)
}
...
...
@@ -226,22 +223,30 @@ open class NavigationBar: UINavigationBar {
titleView
.
grid
.
views
.
append
(
contentView
)
for
v
in
item
.
rightControls
{
var
w
:
CGFloat
=
0
if
let
b
=
v
as?
UIButton
{
b
.
contentEdgeInsets
=
.
zero
b
.
sizeToFit
()
w
=
b
.
width
}
v
.
height
=
frame
.
size
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
v
.
grid
.
columns
=
Int
(
ceil
(
w
/
gridFactor
))
+
1
(
v
as?
UIButton
)?
.
contentEdgeInsets
=
.
zero
v
.
sizeToFit
()
v
.
grid
.
columns
=
Int
(
ceil
(
v
.
width
/
gridFactor
))
+
1
contentView
.
grid
.
columns
-
=
v
.
grid
.
columns
rc
+
=
v
.
grid
.
columns
titleView
.
grid
.
views
.
append
(
v
)
}
titleView
.
grid
.
contentEdgeInsets
=
contentEdgeInsets
if
.
center
==
item
.
contentViewAlignment
{
if
lc
<
rc
{
contentView
.
grid
.
columns
=
columns
-
2
*
rc
contentView
.
grid
.
offset
.
columns
=
rc
-
lc
}
else
{
contentView
.
grid
.
columns
=
columns
-
2
*
lc
item
.
rightControls
.
first
?
.
grid
.
offset
.
columns
=
lc
-
rc
}
}
else
{
contentView
.
grid
.
columns
=
columns
-
lc
-
rc
}
titleView
.
grid
.
interimSpace
=
interimSpace
titleView
.
grid
.
contentEdgeInsets
=
contentEdgeInsets
titleView
.
grid
.
deferred
=
false
titleView
.
grid
.
reload
()
// contentView alignment.
...
...
@@ -265,14 +270,14 @@ open class NavigationBar: UINavigationBar {
item
.
titleLabel
.
sizeToFit
()
item
.
detailLabel
.
sizeToFit
()
let
diff
=
(
contentView
.
frame
.
height
-
item
.
titleLabel
.
frame
.
height
-
item
.
detailLabel
.
frame
.
height
)
/
2
let
diff
=
(
contentView
.
height
-
item
.
titleLabel
.
height
-
item
.
detailLabel
.
height
)
/
2
item
.
titleLabel
.
frame
.
size
.
height
+=
diff
item
.
titleLabel
.
frame
.
size
.
width
=
contentView
.
frame
.
width
item
.
titleLabel
.
height
+=
diff
item
.
titleLabel
.
width
=
contentView
.
width
item
.
detailLabel
.
frame
.
size
.
height
+=
diff
item
.
detailLabel
.
frame
.
size
.
width
=
contentView
.
frame
.
width
item
.
detailLabel
.
frame
.
origin
.
y
=
item
.
titleLabel
.
frame
.
height
item
.
detailLabel
.
height
+=
diff
item
.
detailLabel
.
width
=
contentView
.
width
item
.
detailLabel
.
y
=
item
.
titleLabel
.
height
}
}
else
{
item
.
detailLabel
.
removeFromSuperview
()
...
...
@@ -334,7 +339,6 @@ open class NavigationBar: UINavigationBar {
if
nil
==
item
.
contentView
{
item
.
contentView
=
UIView
(
frame
:
.
zero
)
}
item
.
contentView
!.
grid
.
axis
.
direction
=
.
vertical
return
item
.
contentView
!
}
...
...
Sources/iOS/NavigationController.swift
View file @
c173989f
...
...
@@ -112,10 +112,10 @@ open class NavigationController: UINavigationController {
when subclassing.
*/
open
func
prepareView
()
{
edgesForExtendedLayout
=
[]
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
Color
.
white
view
.
contentScaleFactor
=
Device
.
scale
automaticallyAdjustsScrollViewInsets
=
false
// This ensures the panning gesture is available when going back between views.
if
let
v
=
interactivePopGestureRecognizer
{
...
...
Sources/iOS/NavigationItem.swift
View file @
c173989f
...
...
@@ -32,14 +32,16 @@ import UIKit
/// A memory reference to the NavigationItem instance.
private
var
NavigationItemKey
:
UInt8
=
0
private
var
NavigationItemContext
:
UInt8
=
0
public
class
NavigationItem
{
/**
A boolean indicating whether keys are being observed
on the UINavigationItem.
*/
internal
var
observed
=
false
public
class
NavigationItem
:
NSObject
{
/// Should center the contentView.
open
var
contentViewAlignment
=
ContentViewAlignment
.
center
{
didSet
{
navigationBar
?
.
layoutSubviews
()
}
}
/// Back Button.
public
var
backButton
:
IconButton
?
...
...
@@ -47,10 +49,10 @@ public class NavigationItem {
public
var
contentView
:
UIView
?
/// Title label.
public
private(set)
var
titleLabel
:
UILabel
!
public
private(set)
lazy
var
titleLabel
:
UILabel
=
UILabel
()
/// Detail label.
public
private(set)
var
detailLabel
:
UILabel
!
public
private(set)
lazy
var
detailLabel
:
UILabel
=
UILabel
()
/// Left controls.
public
var
leftControls
=
[
UIView
]()
...
...
@@ -58,30 +60,43 @@ public class NavigationItem {
/// Right controls.
public
var
rightControls
=
[
UIView
]()
public
var
navigationBar
:
NavigationBar
?
{
return
contentView
?
.
superview
?
.
superview
as?
NavigationBar
}
open
override
func
observeValue
(
forKeyPath
keyPath
:
String
?,
of
object
:
Any
?,
change
:
[
NSKeyValueChangeKey
:
Any
]?,
context
:
UnsafeMutableRawPointer
?)
{
guard
"titleLabel.textAlignment"
==
keyPath
else
{
super
.
observeValue
(
forKeyPath
:
keyPath
,
of
:
object
,
change
:
change
,
context
:
context
)
return
}
contentViewAlignment
=
.
center
==
titleLabel
.
textAlignment
?
.
center
:
.
any
}
deinit
{
removeObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
)
}
/// Initializer.
public
init
()
{
prepareTitleLabel
()
public
override
init
()
{
super
.
init
()
prepareTitleLabel
()
prepareDetailLabel
()
}
/// Reloads the subviews for the NavigationBar.
internal
func
reload
()
{
guard
let
navigationBar
=
contentView
?
.
superview
?
.
superview
as?
NavigationBar
else
{
return
}
navigationBar
.
layoutSubviews
()
navigationBar
?
.
layoutSubviews
()
}
/// Prepares the titleLabel.
private
func
prepareTitleLabel
()
{
titleLabel
=
UILabel
()
titleLabel
.
font
=
RobotoFont
.
medium
(
with
:
17
)
titleLabel
.
textAlignment
=
.
center
addObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
,
options
:
[],
context
:
&
NavigationItemContext
)
}
/// Prepares the detailLabel.
private
func
prepareDetailLabel
()
{
detailLabel
=
UILabel
()
detailLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
detailLabel
.
textAlignment
=
.
center
}
...
...
@@ -99,9 +114,14 @@ extension UINavigationItem {
AssociateObject
(
base
:
self
,
key
:
&
NavigationItemKey
,
value
:
value
)
}
}
/// Should center the contentView.
open
var
contentViewAlignment
:
ContentViewAlignment
{
return
navigationItem
.
contentViewAlignment
}
/// Back Button.
public
internal(set)
var
backButton
:
IconButton
?
{
open
internal(set)
var
backButton
:
IconButton
?
{
get
{
return
navigationItem
.
backButton
}
...
...
@@ -111,7 +131,7 @@ extension UINavigationItem {
}
/// Content View.
public
internal(set)
var
contentView
:
UIView
?
{
open
internal(set)
var
contentView
:
UIView
?
{
get
{
return
navigationItem
.
contentView
}
...
...
@@ -121,7 +141,7 @@ extension UINavigationItem {
}
@nonobjc
public
var
title
:
String
?
{
open
var
title
:
String
?
{
get
{
return
titleLabel
.
text
}
...
...
@@ -132,12 +152,12 @@ extension UINavigationItem {
}
/// Title Label.
public
var
titleLabel
:
UILabel
{
open
var
titleLabel
:
UILabel
{
return
navigationItem
.
titleLabel
}
/// Detail text.
public
var
detail
:
String
?
{
open
var
detail
:
String
?
{
get
{
return
detailLabel
.
text
}
...
...
@@ -148,12 +168,12 @@ extension UINavigationItem {
}
/// Detail Label.
public
var
detailLabel
:
UILabel
{
open
var
detailLabel
:
UILabel
{
return
navigationItem
.
detailLabel
}
/// Left side UIViews.
public
var
leftControls
:
[
UIView
]
{
open
var
leftControls
:
[
UIView
]
{
get
{
return
navigationItem
.
leftControls
}
...
...
@@ -163,7 +183,7 @@ extension UINavigationItem {
}
/// Right side UIViews.
public
var
rightControls
:
[
UIView
]
{
open
var
rightControls
:
[
UIView
]
{
get
{
return
navigationItem
.
rightControls
}
...
...
Sources/iOS/PageTabBarController.swift
View file @
c173989f
...
...
@@ -148,13 +148,11 @@ open class PageTabBarController: RootController {
open
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
let
w
=
view
.
width
let
h
=
view
.
height
let
p
=
pageTabBar
.
intrinsicContentSize
.
height
+
pageTabBar
.
grid
.
layoutEdgeInsets
.
top
+
pageTabBar
.
grid
.
layoutEdgeInsets
.
bottom
let
y
=
h
-
p
let
y
=
view
.
height
-
p
pageTabBar
.
height
=
p
pageTabBar
.
width
=
w
+
pageTabBar
.
grid
.
layoutEdgeInsets
.
left
+
pageTabBar
.
grid
.
layoutEdgeInsets
.
right
pageTabBar
.
width
=
view
.
width
+
pageTabBar
.
grid
.
layoutEdgeInsets
.
left
+
pageTabBar
.
grid
.
layoutEdgeInsets
.
right
rootViewController
.
view
.
height
=
y
...
...
Sources/iOS/PhotoLibraryController.swift
View file @
c173989f
...
...
@@ -47,7 +47,6 @@ open class PhotoLibraryController: UIViewController, PhotoLibraryDelegate {
when subclassing.
*/
open
func
prepareView
()
{
edgesForExtendedLayout
=
[]
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
Color
.
white
view
.
contentScaleFactor
=
Device
.
scale
...
...
Sources/iOS/RootController.swift
View file @
c173989f
...
...
@@ -151,10 +151,12 @@ open class RootController: UIViewController {
when subclassing.
*/
open
func
prepareView
()
{
edgesForExtendedLayout
=
[]
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
Color
.
white
view
.
contentScaleFactor
=
Device
.
scale
automaticallyAdjustsScrollViewInsets
=
false
edgesForExtendedLayout
=
[]
prepareRootViewController
()
}
...
...
Sources/iOS/SearchBarController.swift
View file @
c173989f
...
...
@@ -62,15 +62,13 @@ open class SearchBarController: RootController {
searchBar
.
grid
.
layoutEdgeInsets
.
top
=
.
phone
==
Device
.
userInterfaceIdiom
&&
Device
.
isLandscape
?
0
:
20
let
w
=
view
.
width
let
h
=
view
.
height
let
p
=
searchBar
.
intrinsicContentSize
.
height
+
searchBar
.
grid
.
layoutEdgeInsets
.
top
+
searchBar
.
grid
.
layoutEdgeInsets
.
bottom
searchBar
.
width
=
w
+
searchBar
.
grid
.
layoutEdgeInsets
.
left
+
searchBar
.
grid
.
layoutEdgeInsets
.
right
searchBar
.
width
=
view
.
width
+
searchBar
.
grid
.
layoutEdgeInsets
.
left
+
searchBar
.
grid
.
layoutEdgeInsets
.
right
searchBar
.
height
=
p
rootViewController
.
view
.
y
=
p
rootViewController
.
view
.
height
=
h
-
p
rootViewController
.
view
.
height
=
view
.
height
-
p
searchBar
.
divider
.
reload
()
}
...
...
Sources/iOS/Snackbar.swift
View file @
c173989f
...
...
@@ -40,16 +40,16 @@ open class Snackbar: BarView {
/// A convenience property to set the titleLabel text.
public
var
text
:
String
?
{
get
{
return
textLabel
?
.
text
return
textLabel
.
text
}
set
(
value
)
{
textLabel
?
.
text
=
value
textLabel
.
text
=
value
layoutSubviews
()
}
}
/// Text label.
public
internal(set)
var
textLabel
:
UILabel
!
public
internal(set)
lazy
var
textLabel
=
UILabel
()
open
override
var
intrinsicContentSize
:
CGSize
{
return
CGSize
(
width
:
width
,
height
:
49
)
...
...
@@ -97,11 +97,14 @@ open class Snackbar: BarView {
/// Prepares the textLabel.
private
func
prepareTextLabel
()
{
textLabel
=
UILabel
()
textLabel
.
contentScaleFactor
=
Device
.
scale
textLabel
.
font
=
RobotoFont
.
medium
(
with
:
14
)
textLabel
.
textAlignment
=
.
left
textLabel
.
textColor
=
Color
.
white
textLabel
.
numberOfLines
=
0
contentView
.
grid
.
deferred
=
true
contentView
.
grid
.
views
.
append
(
textLabel
)
contentView
.
grid
.
deferred
=
false
}
}
Sources/iOS/Toolbar.swift
View file @
c173989f
...
...
@@ -45,7 +45,7 @@ open class Toolbar: BarView {
}
/// Title label.
open
internal(set)
var
titleLabel
=
UILabel
()
open
internal(set)
lazy
var
titleLabel
=
UILabel
()
/// A convenience property to set the detailLabel text.
open
var
detail
:
String
?
{
...
...
@@ -59,11 +59,10 @@ open class Toolbar: BarView {
}
/// Detail label.
open
internal(set)
var
detailLabel
=
UILabel
()
open
internal(set)
lazy
var
detailLabel
=
UILabel
()
deinit
{
removeObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
)
removeObserver
(
self
,
forKeyPath
:
"detailLabel.textAlignment"
)
}
/**
...
...
@@ -94,7 +93,11 @@ open class Toolbar: BarView {
}
open
override
func
observeValue
(
forKeyPath
keyPath
:
String
?,
of
object
:
Any
?,
change
:
[
NSKeyValueChangeKey
:
Any
]?,
context
:
UnsafeMutableRawPointer
?)
{
contentViewAlignment
=
.
center
==
titleLabel
.
textAlignment
||
.
center
==
detailLabel
.
textAlignment
?
.
center
:
.
any
guard
"titleLabel.textAlignment"
==
keyPath
else
{
super
.
observeValue
(
forKeyPath
:
keyPath
,
of
:
object
,
change
:
change
,
context
:
context
)
return
}
contentViewAlignment
=
.
center
==
titleLabel
.
textAlignment
?
.
center
:
.
any
}
open
override
func
layoutSubviews
()
{
...
...
@@ -146,21 +149,23 @@ open class Toolbar: BarView {
*/
open
override
func
prepareView
()
{
super
.
prepareView
()
contentViewAlignment
=
.
center
prepareTitleLabel
()
prepareDetailLabel
()
}
/// Prepares the titleLabel.
private
func
prepareTitleLabel
()
{
titleLabel
.
contentScaleFactor
=
Device
.
scale
titleLabel
.
contentScaleFactor
=
Device
.
scale
titleLabel
.
font
=
RobotoFont
.
medium
(
with
:
17
)
titleLabel
.
textAlignment
=
.
center
addObserver
(
self
,
forKeyPath
:
"titleLabel.textAlignment"
,
options
:
[],
context
:
&
ToolbarContext
)
}
/// Prepares the detailLabel.
private
func
prepareDetailLabel
()
{
detailLabel
.
contentScaleFactor
=
Device
.
scale
detailLabel
.
contentScaleFactor
=
Device
.
scale
detailLabel
.
font
=
RobotoFont
.
regular
(
with
:
12
)
addObserver
(
self
,
forKeyPath
:
"detailLabel.textAlignment"
,
options
:
[],
context
:
&
ToolbarContext
)
detailLabel
.
textAlignment
=
.
center
}
}
Sources/iOS/ToolbarController.swift
View file @
c173989f
...
...
@@ -165,15 +165,13 @@ open class ToolbarController: RootController {
toolbar
.
grid
.
layoutEdgeInsets
.
top
=
.
phone
==
Device
.
userInterfaceIdiom
&&
Device
.
isLandscape
?
0
:
20
let
w
=
view
.
width
let
h
=
view
.
height
let
p
=
toolbar
.
intrinsicContentSize
.
height
+
toolbar
.
grid
.
layoutEdgeInsets
.
top
+
toolbar
.
grid
.
layoutEdgeInsets
.
bottom
toolbar
.
width
=
w
+
toolbar
.
grid
.
layoutEdgeInsets
.
left
+
toolbar
.
grid
.
layoutEdgeInsets
.
right
toolbar
.
width
=
view
.
width
+
toolbar
.
grid
.
layoutEdgeInsets
.
left
+
toolbar
.
grid
.
layoutEdgeInsets
.
right
toolbar
.
height
=
p
rootViewController
.
view
.
y
=
p
rootViewController
.
view
.
height
=
h
-
p
rootViewController
.
view
.
height
=
view
.
height
-
p
toolbar
.
divider
.
reload
()
}
...
...
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