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
ef382688
Commit
ef382688
authored
Sep 29, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added button logic
parent
f77ba634
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
72 additions
and
50 deletions
+72
-50
Source/BasicCardView.swift
+40
-25
Source/NavigationBarView.swift
+32
-25
No files found.
Source/BasicCardView.swift
View file @
ef382688
...
@@ -248,38 +248,44 @@ public class BasicCardView: MaterialPulseView {
...
@@ -248,38 +248,44 @@ public class BasicCardView: MaterialPulseView {
// leftButtons
// leftButtons
if
let
v
=
leftButtons
{
if
let
v
=
leftButtons
{
var
h
:
String
=
"H:|"
if
0
<
v
.
count
{
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
h
:
String
=
"H:|"
var
i
:
Int
=
0
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
i
:
Int
=
0
for
b
in
v
{
let
k
:
String
=
"b
\(
i
++
)
"
for
b
in
v
{
d
[
k
]
=
b
let
k
:
String
=
"b
\(
i
++
)
"
h
+=
"-(left)-[
\(
k
)
]"
d
[
k
]
=
b
h
+=
"-(left)-[
\(
k
)
]"
addSubview
(
b
)
b
.
layer
.
zPosition
=
2000
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
leftButtonsInsetsRef
!.
bottom
)
}
insertSubview
(
b
,
atIndex
:
1
)
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
leftButtonsInsetsRef
!.
left
],
views
:
d
))
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
leftButtonsInsetsRef
!.
bottom
)
}
}
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
leftButtonsInsetsRef
!.
left
],
views
:
d
))
}
}
// rightButtons
// rightButtons
if
let
v
=
rightButtons
{
if
let
v
=
rightButtons
{
var
h
:
String
=
"H:"
if
0
<
v
.
count
{
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
h
:
String
=
"H:"
var
i
:
Int
=
0
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
i
:
Int
=
0
for
b
in
v
{
let
k
:
String
=
"b
\(
i
++
)
"
for
b
in
v
{
d
[
k
]
=
b
let
k
:
String
=
"b
\(
i
++
)
"
h
+=
"[
\(
k
)
]-(right)-"
d
[
k
]
=
b
h
+=
"[
\(
k
)
]-(right)-"
addSubview
(
b
)
b
.
layer
.
zPosition
=
2000
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
rightButtonsInsetsRef
!.
bottom
)
}
insertSubview
(
b
,
atIndex
:
1
)
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
rightButtonsInsetsRef
!.
right
],
views
:
d
))
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
rightButtonsInsetsRef
!.
bottom
)
}
}
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
rightButtonsInsetsRef
!.
right
],
views
:
d
))
}
}
if
nil
!=
titleLabel
{
if
nil
!=
titleLabel
{
...
@@ -294,8 +300,17 @@ public class BasicCardView: MaterialPulseView {
...
@@ -294,8 +300,17 @@ public class BasicCardView: MaterialPulseView {
metrics
[
"insetBottom"
]
=
(
metrics
[
"insetBottom"
]
as!
CGFloat
)
+
titleLabelInsetsRef
!.
bottom
metrics
[
"insetBottom"
]
=
(
metrics
[
"insetBottom"
]
as!
CGFloat
)
+
titleLabelInsetsRef
!.
bottom
}
}
if
0
<
views
.
count
{
if
0
<
leftButtons
?
.
count
{
verticalFormat
+=
"-[button]-|"
views
[
"button"
]
=
leftButtons
!
[
0
]
}
else
if
0
<
rightButtons
?
.
count
{
verticalFormat
+=
"-[button]-|"
views
[
"button"
]
=
rightButtons
!
[
0
]
}
else
{
verticalFormat
+=
"-(insetBottom)-|"
verticalFormat
+=
"-(insetBottom)-|"
}
if
0
<
views
.
count
{
addConstraints
(
MaterialLayout
.
constraint
(
verticalFormat
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
addConstraints
(
MaterialLayout
.
constraint
(
verticalFormat
,
options
:
[],
metrics
:
metrics
,
views
:
views
))
}
}
...
...
Source/NavigationBarView.swift
View file @
ef382688
...
@@ -165,45 +165,52 @@ public class NavigationBarView: MaterialView {
...
@@ -165,45 +165,52 @@ public class NavigationBarView: MaterialView {
// leftButtons
// leftButtons
if
let
v
=
leftButtons
{
if
let
v
=
leftButtons
{
var
h
:
String
=
"H:|"
if
0
<
v
.
count
{
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
h
:
String
=
"H:|"
var
i
:
Int
=
0
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
i
:
Int
=
0
for
b
in
v
{
let
k
:
String
=
"b
\(
i
++
)
"
d
[
k
]
=
b
h
+=
"-(left)-[
\(
k
)
]"
insertSubview
(
b
,
atIndex
:
1
)
for
b
in
v
{
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
leftButtonsInsetsRef
!.
bottom
)
let
k
:
String
=
"b
\(
i
++
)
"
d
[
k
]
=
b
h
+=
"-(left)-[
\(
k
)
]"
addSubview
(
b
)
b
.
layer
.
zPosition
=
2000
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
leftButtonsInsetsRef
!.
bottom
)
}
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
leftButtonsInsetsRef
!.
left
],
views
:
d
))
}
}
addConstraints
(
MaterialLayout
.
constraint
(
h
,
options
:
[],
metrics
:
[
"left"
:
leftButtonsInsetsRef
!.
left
],
views
:
d
))
}
}
// title
// title
if
let
v
=
titleLabel
{
if
let
v
=
titleLabel
{
insertSubview
(
v
,
atIndex
:
0
)
addSubview
(
v
)
v
.
layer
.
zPosition
=
1500
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
titleLabelInsetsRef
!.
left
,
right
:
titleLabelInsetsRef
!.
right
)
MaterialLayout
.
alignToParentHorizontallyWithInsets
(
self
,
child
:
v
,
left
:
titleLabelInsetsRef
!.
left
,
right
:
titleLabelInsetsRef
!.
right
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
v
,
bottom
:
titleLabelInsetsRef
!.
bottom
)
MaterialLayout
.
alignFromBottom
(
self
,
child
:
v
,
bottom
:
titleLabelInsetsRef
!.
bottom
)
}
}
// rightButtons
// rightButtons
if
let
v
=
rightButtons
{
if
let
v
=
rightButtons
{
var
h
:
String
=
"H:"
if
0
<
v
.
count
{
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
h
:
String
=
"H:"
var
i
:
Int
=
0
var
d
:
Dictionary
<
String
,
AnyObject
>
=
Dictionary
<
String
,
AnyObject
>
()
var
i
:
Int
=
0
for
b
in
v
{
let
k
:
String
=
"b
\(
i
++
)
"
for
b
in
v
{
d
[
k
]
=
b
let
k
:
String
=
"b
\(
i
++
)
"
h
+=
"[
\(
k
)
]-(right)-"
d
[
k
]
=
b
h
+=
"[
\(
k
)
]-(right)-"
addSubview
(
b
)
b
.
layer
.
zPosition
=
2000
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
rightButtonsInsetsRef
!.
bottom
)
}
insertSubview
(
b
,
atIndex
:
1
)
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
rightButtonsInsetsRef
!.
right
],
views
:
d
))
MaterialLayout
.
alignFromBottom
(
self
,
child
:
b
,
bottom
:
rightButtonsInsetsRef
!.
bottom
)
}
}
addConstraints
(
MaterialLayout
.
constraint
(
h
+
"|"
,
options
:
[],
metrics
:
[
"right"
:
rightButtonsInsetsRef
!.
right
],
views
:
d
))
}
}
}
}
...
...
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