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
a89ba9a7
Unverified
Commit
a89ba9a7
authored
Oct 15, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: updated Divider to use thickness rather than height
parent
f7279fc6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
40 deletions
+40
-40
Sources/iOS/Divider.swift
+13
-13
Sources/iOS/Grid.swift
+25
-25
Sources/iOS/TextField.swift
+2
-2
No files found.
Sources/iOS/Divider.swift
View file @
a89ba9a7
...
@@ -46,7 +46,7 @@ open class Divider {
...
@@ -46,7 +46,7 @@ open class Divider {
internal
var
line
:
UIView
?
internal
var
line
:
UIView
?
/// A reference to the height.
/// A reference to the height.
open
var
height
:
CGFloat
open
var
thickness
:
CGFloat
/// A preset wrapper around contentEdgeInsets.
/// A preset wrapper around contentEdgeInsets.
open
var
contentEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
open
var
contentEdgeInsetsPreset
=
EdgeInsetsPreset
.
none
{
...
@@ -93,14 +93,15 @@ open class Divider {
...
@@ -93,14 +93,15 @@ open class Divider {
/**
/**
Initializer that takes in a UIView.
Initializer that takes in a UIView.
- Parameter view: A UIView reference.
- Parameter view: A UIView reference.
- Parameter thickness: A CGFloat value.
*/
*/
internal
init
(
view
:
UIView
?,
height
:
CGFloat
=
1
)
{
internal
init
(
view
:
UIView
?,
thickness
:
CGFloat
=
1
)
{
self
.
view
=
view
self
.
view
=
view
self
.
height
=
height
self
.
thickness
=
thickness
}
}
/// Lays out the divider.
/// Lays out the divider.
internal
func
reload
()
{
open
func
reload
()
{
guard
let
l
=
line
,
let
v
=
view
else
{
guard
let
l
=
line
,
let
v
=
view
else
{
return
return
}
}
...
@@ -109,13 +110,13 @@ open class Divider {
...
@@ -109,13 +110,13 @@ open class Divider {
switch
alignment
{
switch
alignment
{
case
.
top
:
case
.
top
:
l
.
frame
=
CGRect
(
x
:
c
.
left
,
y
:
c
.
top
,
width
:
v
.
width
-
c
.
left
-
c
.
right
,
height
:
height
-
c
.
top
-
c
.
bottom
)
l
.
frame
=
CGRect
(
x
:
c
.
left
,
y
:
c
.
top
,
width
:
v
.
width
-
c
.
left
-
c
.
right
,
height
:
thickness
)
case
.
bottom
:
case
.
bottom
:
l
.
frame
=
CGRect
(
x
:
c
.
left
,
y
:
v
.
height
-
height
-
c
.
bottom
,
width
:
v
.
width
-
c
.
left
-
c
.
right
,
height
:
height
-
c
.
top
-
c
.
bottom
)
l
.
frame
=
CGRect
(
x
:
c
.
left
,
y
:
v
.
height
-
thickness
-
c
.
bottom
,
width
:
v
.
width
-
c
.
left
-
c
.
right
,
height
:
thickness
)
case
.
left
:
case
.
left
:
l
.
frame
=
CGRect
(
x
:
c
.
left
,
y
:
c
.
top
,
width
:
height
,
height
:
v
.
height
-
c
.
top
-
c
.
bottom
)
l
.
frame
=
CGRect
(
x
:
c
.
left
,
y
:
c
.
top
,
width
:
thickness
,
height
:
v
.
height
-
c
.
top
-
c
.
bottom
)
case
.
right
:
case
.
right
:
l
.
frame
=
CGRect
(
x
:
v
.
width
-
height
-
c
.
right
,
y
:
c
.
top
,
width
:
height
,
height
:
v
.
height
-
c
.
top
-
c
.
bottom
)
l
.
frame
=
CGRect
(
x
:
v
.
width
-
thickness
-
c
.
right
,
y
:
c
.
top
,
width
:
thickness
,
height
:
v
.
height
-
c
.
top
-
c
.
bottom
)
}
}
}
}
}
}
...
@@ -157,15 +158,14 @@ extension UIView {
...
@@ -157,15 +158,14 @@ extension UIView {
}
}
}
}
/// Divider
height
.
/// Divider
thickness
.
@IBInspectable
@IBInspectable
open
var
divider
Height
:
CGFloat
{
open
var
divider
Thickness
:
CGFloat
{
get
{
get
{
return
divider
.
height
return
divider
.
thickness
}
}
set
(
value
)
{
set
(
value
)
{
divider
.
height
=
value
divider
.
thickness
=
value
}
}
}
}
}
}
Sources/iOS/Grid.swift
View file @
a89ba9a7
...
@@ -223,56 +223,56 @@ public class Grid {
...
@@ -223,56 +223,56 @@ public class Grid {
var
n
:
Int
=
0
var
n
:
Int
=
0
var
i
:
Int
=
0
var
i
:
Int
=
0
for
child
in
views
{
for
v
in
views
{
guard
let
canvas
=
context
else
{
guard
let
canvas
=
context
else
{
return
return
}
}
if
canvas
!=
child
.
superview
{
if
canvas
!=
v
.
superview
{
child
.
removeFromSuperview
()
v
.
removeFromSuperview
()
canvas
.
addSubview
(
child
)
canvas
.
addSubview
(
v
)
}
}
// Forces the views to adjust accordingly to size changes, ie: UILabel.
// Forces the views to adjust accordingly to size changes, ie: UILabel.
(
child
as?
UILabel
)?
.
sizeToFit
()
(
v
as?
UILabel
)?
.
sizeToFit
()
switch
axis
.
direction
{
switch
axis
.
direction
{
case
.
horizontal
:
case
.
horizontal
:
let
c
=
0
==
child
.
grid
.
columns
?
axis
.
columns
/
count
:
child
.
grid
.
columns
let
c
=
0
==
v
.
grid
.
columns
?
axis
.
columns
/
count
:
v
.
grid
.
columns
let
co
=
child
.
grid
.
offset
.
columns
let
co
=
v
.
grid
.
offset
.
columns
let
w
=
(
canvas
.
bounds
.
width
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
-
layoutEdgeInsets
.
left
-
layoutEdgeInsets
.
right
+
interimSpace
)
/
CGFloat
(
axis
.
columns
)
let
w
=
(
canvas
.
bounds
.
width
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
-
layoutEdgeInsets
.
left
-
layoutEdgeInsets
.
right
+
interimSpace
)
/
CGFloat
(
axis
.
columns
)
child
.
x
=
CGFloat
(
i
+
n
+
co
)
*
w
+
contentEdgeInsets
.
left
+
layoutEdgeInsets
.
left
v
.
x
=
CGFloat
(
i
+
n
+
co
)
*
w
+
contentEdgeInsets
.
left
+
layoutEdgeInsets
.
left
child
.
y
=
contentEdgeInsets
.
top
+
layoutEdgeInsets
.
top
v
.
y
=
contentEdgeInsets
.
top
+
layoutEdgeInsets
.
top
child
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
v
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
child
.
height
=
canvas
.
bounds
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
-
layoutEdgeInsets
.
top
-
layoutEdgeInsets
.
bottom
v
.
height
=
canvas
.
bounds
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
-
layoutEdgeInsets
.
top
-
layoutEdgeInsets
.
bottom
n
+=
c
+
co
-
1
n
+=
c
+
co
-
1
case
.
vertical
:
case
.
vertical
:
let
r
=
0
==
child
.
grid
.
rows
?
axis
.
rows
/
count
:
child
.
grid
.
rows
let
r
=
0
==
v
.
grid
.
rows
?
axis
.
rows
/
count
:
v
.
grid
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
ro
=
v
.
grid
.
offset
.
rows
let
h
=
(
canvas
.
bounds
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
-
layoutEdgeInsets
.
top
-
layoutEdgeInsets
.
bottom
+
interimSpace
)
/
CGFloat
(
axis
.
rows
)
let
h
=
(
canvas
.
bounds
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
-
layoutEdgeInsets
.
top
-
layoutEdgeInsets
.
bottom
+
interimSpace
)
/
CGFloat
(
axis
.
rows
)
child
.
x
=
contentEdgeInsets
.
left
+
layoutEdgeInsets
.
left
v
.
x
=
contentEdgeInsets
.
left
+
layoutEdgeInsets
.
left
child
.
y
=
CGFloat
(
i
+
n
+
ro
)
*
h
+
contentEdgeInsets
.
top
+
layoutEdgeInsets
.
top
v
.
y
=
CGFloat
(
i
+
n
+
ro
)
*
h
+
contentEdgeInsets
.
top
+
layoutEdgeInsets
.
top
child
.
width
=
canvas
.
bounds
.
width
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
-
layoutEdgeInsets
.
left
-
layoutEdgeInsets
.
right
v
.
width
=
canvas
.
bounds
.
width
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
-
layoutEdgeInsets
.
left
-
layoutEdgeInsets
.
right
child
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
v
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
n
+=
r
+
ro
-
1
n
+=
r
+
ro
-
1
case
.
any
:
case
.
any
:
let
r
=
0
==
child
.
grid
.
rows
?
axis
.
rows
/
count
:
child
.
grid
.
rows
let
r
=
0
==
v
.
grid
.
rows
?
axis
.
rows
/
count
:
v
.
grid
.
rows
let
ro
=
child
.
grid
.
offset
.
rows
let
ro
=
v
.
grid
.
offset
.
rows
let
c
=
0
==
child
.
grid
.
columns
?
axis
.
columns
/
count
:
child
.
grid
.
columns
let
c
=
0
==
v
.
grid
.
columns
?
axis
.
columns
/
count
:
v
.
grid
.
columns
let
co
=
child
.
grid
.
offset
.
columns
let
co
=
v
.
grid
.
offset
.
columns
let
w
=
(
canvas
.
bounds
.
width
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
-
layoutEdgeInsets
.
left
-
layoutEdgeInsets
.
right
+
interimSpace
)
/
CGFloat
(
axis
.
columns
)
let
w
=
(
canvas
.
bounds
.
width
-
contentEdgeInsets
.
left
-
contentEdgeInsets
.
right
-
layoutEdgeInsets
.
left
-
layoutEdgeInsets
.
right
+
interimSpace
)
/
CGFloat
(
axis
.
columns
)
let
h
=
(
canvas
.
bounds
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
-
layoutEdgeInsets
.
top
-
layoutEdgeInsets
.
bottom
+
interimSpace
)
/
CGFloat
(
axis
.
rows
)
let
h
=
(
canvas
.
bounds
.
height
-
contentEdgeInsets
.
top
-
contentEdgeInsets
.
bottom
-
layoutEdgeInsets
.
top
-
layoutEdgeInsets
.
bottom
+
interimSpace
)
/
CGFloat
(
axis
.
rows
)
child
.
x
=
CGFloat
(
co
)
*
w
+
contentEdgeInsets
.
left
+
layoutEdgeInsets
.
left
v
.
x
=
CGFloat
(
co
)
*
w
+
contentEdgeInsets
.
left
+
layoutEdgeInsets
.
left
child
.
y
=
CGFloat
(
ro
)
*
h
+
contentEdgeInsets
.
top
+
layoutEdgeInsets
.
top
v
.
y
=
CGFloat
(
ro
)
*
h
+
contentEdgeInsets
.
top
+
layoutEdgeInsets
.
top
child
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
v
.
width
=
w
*
CGFloat
(
c
)
-
interimSpace
child
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
v
.
height
=
h
*
CGFloat
(
r
)
-
interimSpace
}
}
i
+=
1
i
+=
1
...
...
Sources/iOS/TextField.swift
View file @
a89ba9a7
...
@@ -489,13 +489,13 @@ open class TextField: UITextField {
...
@@ -489,13 +489,13 @@ open class TextField: UITextField {
/// The animation for the divider when editing begins.
/// The animation for the divider when editing begins.
open
func
dividerEditingDidBeginAnimation
()
{
open
func
dividerEditingDidBeginAnimation
()
{
divider
Height
=
dividerActiveHeight
divider
Thickness
=
dividerActiveHeight
dividerColor
=
dividerActiveColor
dividerColor
=
dividerActiveColor
}
}
/// The animation for the divider when editing ends.
/// The animation for the divider when editing ends.
open
func
dividerEditingDidEndAnimation
()
{
open
func
dividerEditingDidEndAnimation
()
{
divider
Height
=
dividerNormalHeight
divider
Thickness
=
dividerNormalHeight
dividerColor
=
dividerNormalColor
dividerColor
=
dividerNormalColor
}
}
...
...
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