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
b53376dd
Commit
b53376dd
authored
Aug 13, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: Update Grid to no longer use an optional views array.
parent
d0e01ffe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
56 deletions
+55
-56
Sources/iOS/ControlView.swift
+3
-3
Sources/iOS/Grid.swift
+49
-50
Sources/iOS/NavigationBar.swift
+3
-3
No files found.
Sources/iOS/ControlView.swift
View file @
b53376dd
...
...
@@ -185,12 +185,12 @@ public class ControlView: View {
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
addSubview
(
c
)
grid
.
views
?
.
append
(
c
)
grid
.
views
.
append
(
c
)
}
}
addSubview
(
contentView
)
grid
.
views
?
.
append
(
contentView
)
grid
.
views
.
append
(
contentView
)
// rightControls
if
let
v
=
rightControls
{
...
...
@@ -205,7 +205,7 @@ public class ControlView: View {
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
addSubview
(
c
)
grid
.
views
?
.
append
(
c
)
grid
.
views
.
append
(
c
)
}
}
...
...
Sources/iOS/Grid.swift
View file @
b53376dd
...
...
@@ -172,7 +172,7 @@ public class Grid {
}
/// An Array of UIButtons.
public
var
views
:
[
UIView
]
?
{
public
var
views
:
[
UIView
]
{
didSet
{
reload
()
}
...
...
@@ -189,66 +189,65 @@ public class Grid {
self
.
rows
=
rows
self
.
columns
=
columns
self
.
interimSpace
=
interimSpace
views
=
[
UIView
]()
offset
=
GridOffset
(
grid
:
self
)
axis
=
GridAxis
(
grid
:
self
)
}
/// Reload the button layout.
public
func
reload
()
{
if
let
v
=
views
{
let
gc
=
axis
.
inherited
?
columns
:
axis
.
columns
let
gr
=
axis
.
inherited
?
rows
:
axis
.
rows
var
n
:
Int
=
0
let
gc
=
axis
.
inherited
?
columns
:
axis
.
columns
let
gr
=
axis
.
inherited
?
rows
:
axis
.
rows
var
n
:
Int
=
0
for
i
in
0
..<
views
.
count
{
let
child
=
views
[
i
]
for
i
in
0
..<
v
.
count
{
let
child
=
v
[
i
]
if
let
parent
=
context
{
if
parent
!=
child
.
superview
{
child
.
removeFromSuperview
()
parent
.
addSubview
(
child
)
}
parent
.
layoutIfNeeded
()
if
let
parent
=
context
{
if
parent
!=
child
.
superview
{
child
.
removeFromSuperview
()
parent
.
addSubview
(
child
)
}
switch
axis
.
direction
{
case
.
horizontal
:
let
c
=
child
.
grid
.
columns
let
co
=
child
.
grid
.
offset
.
columns
let
w
=
(
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
+
interimSpace
)
/
CGFloat
(
gc
)
child
.
x
=
CGFloat
(
i
+
n
+
co
)
*
w
+
contentInset
.
left
+
layoutInset
.
left
child
.
y
=
contentInset
.
top
+
layoutInset
.
top
child
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
child
.
height
=
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
parent
.
layoutIfNeeded
()
n
+=
c
+
co
-
1
switch
axis
.
direction
{
case
.
horizontal
:
let
c
=
child
.
grid
.
columns
let
co
=
child
.
grid
.
offset
.
columns
let
w
=
(
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
+
interimSpace
)
/
CGFloat
(
gc
)
child
.
x
=
CGFloat
(
i
+
n
+
co
)
*
w
+
contentInset
.
left
+
layoutInset
.
left
child
.
y
=
contentInset
.
top
+
layoutInset
.
top
child
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
child
.
height
=
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
n
+=
c
+
co
-
1
case
.
vertical
:
let
r
=
child
.
grid
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
h
=
(
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
+
interimSpace
)
/
CGFloat
(
gr
)
child
.
x
=
contentInset
.
left
+
layoutInset
.
left
child
.
y
=
CGFloat
(
i
+
n
+
ro
)
*
h
+
contentInset
.
top
+
layoutInset
.
top
child
.
width
=
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
child
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
n
+=
r
+
ro
-
1
case
.
vertical
:
let
r
=
child
.
grid
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
h
=
(
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
+
interimSpace
)
/
CGFloat
(
gr
)
child
.
x
=
contentInset
.
left
+
layoutInset
.
left
child
.
y
=
CGFloat
(
i
+
n
+
ro
)
*
h
+
contentInset
.
top
+
layoutInset
.
top
child
.
width
=
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
child
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
n
+=
r
+
ro
-
1
case
.
any
:
let
r
=
child
.
grid
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
c
=
child
.
grid
.
columns
let
co
=
child
.
grid
.
offset
.
columns
let
w
=
(
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
+
interimSpace
)
/
CGFloat
(
gc
)
let
h
=
(
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
+
interimSpace
)
/
CGFloat
(
gr
)
case
.
any
:
let
r
=
child
.
grid
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
c
=
child
.
grid
.
columns
let
co
=
child
.
grid
.
offset
.
columns
let
w
=
(
parent
.
bounds
.
width
-
contentInset
.
left
-
contentInset
.
right
-
layoutInset
.
left
-
layoutInset
.
right
+
interimSpace
)
/
CGFloat
(
gc
)
let
h
=
(
parent
.
bounds
.
height
-
contentInset
.
top
-
contentInset
.
bottom
-
layoutInset
.
top
-
layoutInset
.
bottom
+
interimSpace
)
/
CGFloat
(
gr
)
child
.
x
=
CGFloat
(
co
)
*
w
+
contentInset
.
left
+
layoutInset
.
left
child
.
y
=
CGFloat
(
ro
)
*
h
+
contentInset
.
top
+
layoutInset
.
top
child
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
child
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
}
child
.
x
=
CGFloat
(
co
)
*
w
+
contentInset
.
left
+
layoutInset
.
left
child
.
y
=
CGFloat
(
ro
)
*
h
+
contentInset
.
top
+
layoutInset
.
top
child
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
child
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
}
}
}
...
...
Sources/iOS/NavigationBar.swift
View file @
b53376dd
...
...
@@ -219,12 +219,12 @@ public class NavigationBar: UINavigationBar {
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
titleView
.
addSubview
(
c
)
titleView
.
grid
.
views
?
.
append
(
c
)
titleView
.
grid
.
views
.
append
(
c
)
}
}
titleView
.
addSubview
(
contentView
)
titleView
.
grid
.
views
?
.
append
(
contentView
)
titleView
.
grid
.
views
.
append
(
contentView
)
// rightControls
if
let
v
:
Array
<
UIControl
>
=
item
.
rightControls
{
...
...
@@ -239,7 +239,7 @@ public class NavigationBar: UINavigationBar {
contentView
.
grid
.
columns
-=
c
.
grid
.
columns
titleView
.
addSubview
(
c
)
titleView
.
grid
.
views
?
.
append
(
c
)
titleView
.
grid
.
views
.
append
(
c
)
}
}
...
...
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