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
0e404001
Commit
0e404001
authored
Sep 05, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated alignment on BasicCard
parent
13ec5abd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
Source/BasicCardView.swift
+11
-7
No files found.
Source/BasicCardView.swift
View file @
0e404001
...
@@ -191,7 +191,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
...
@@ -191,7 +191,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
*/
*/
public
convenience
init
(
titleLabel
:
UILabel
?
=
nil
,
detailLabel
:
UILabel
?
=
nil
,
divider
:
UIView
?
=
nil
,
leftButtons
:
Array
<
MaterialButton
>
?
=
nil
,
rightButtons
:
Array
<
MaterialButton
>
?
=
nil
)
{
public
convenience
init
(
titleLabel
:
UILabel
?
=
nil
,
detailLabel
:
UILabel
?
=
nil
,
divider
:
UIView
?
=
nil
,
leftButtons
:
Array
<
MaterialButton
>
?
=
nil
,
rightButtons
:
Array
<
MaterialButton
>
?
=
nil
)
{
self
.
init
(
frame
:
CGRectZero
)
self
.
init
(
frame
:
CGRectZero
)
prepareProperties
(
detailLabel
)
prepareProperties
(
titleLabel
,
detailLabel
:
detailLabel
,
divider
:
divider
,
leftButtons
:
leftButtons
,
rightButtons
:
rightButtons
)
}
}
/**
/**
...
@@ -213,8 +213,12 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
...
@@ -213,8 +213,12 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
//
//
// :name: prepareProperties
// :name: prepareProperties
//
//
internal
func
prepareProperties
(
detailLabel
:
UILabel
?)
{
internal
func
prepareProperties
(
titleLabel
:
UILabel
?,
detailLabel
:
UILabel
?,
divider
:
UIView
?,
leftButtons
:
Array
<
MaterialButton
>
?,
rightButtons
:
Array
<
MaterialButton
>
?)
{
self
.
titleLabel
=
titleLabel
self
.
detailLabel
=
detailLabel
self
.
detailLabel
=
detailLabel
self
.
divider
=
divider
self
.
leftButtons
=
leftButtons
self
.
rightButtons
=
rightButtons
}
}
//
//
...
@@ -239,7 +243,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
...
@@ -239,7 +243,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
// text
// text
titleLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"H:|-(horizontalSpace)-[titleLabel]-(horizontalSpace)-|"
,
options
:
nil
,
metrics
:
[
"horizontalSpace"
:
horizontalSpace
],
views
:
[
"titleLabel"
:
titleLabel
!
]))
titleLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"H:|-(horizontalSpace)-[titleLabel]-(horizontalSpace)-|"
,
options
:
nil
,
metrics
:
[
"horizontalSpace"
:
horizontalSpace
],
views
:
[
"titleLabel"
:
titleLabel
!
]))
titleLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(verticalSpace)-[titleLabel(height)]
-(verticalSpace)-
|"
,
options
:
nil
,
metrics
:
[
"verticalSpace"
:
verticalSpace
,
"height"
:
titleLabel
!.
font
.
pointSize
+
verticalSpace
],
views
:
[
"titleLabel"
:
titleLabel
!
]))
titleLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(verticalSpace)-[titleLabel(height)]|"
,
options
:
nil
,
metrics
:
[
"verticalSpace"
:
verticalSpace
,
"height"
:
titleLabel
!.
font
.
pointSize
+
verticalSpace
],
views
:
[
"titleLabel"
:
titleLabel
!
]))
}
}
// detail
// detail
...
@@ -250,8 +254,8 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
...
@@ -250,8 +254,8 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
views
[
"detailLabelContainer"
]
=
detailLabelContainer
!
views
[
"detailLabelContainer"
]
=
detailLabelContainer
!
// text
// text
detailLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"H:|-(horizontalSpace)-[detailLabel]-(horizontalSpace)-|"
,
options
:
nil
,
metrics
:
[
"horizontalSpace"
:
horizontalSpace
],
views
:
[
"detailLabel"
:
detailLabel
!
])
)
Layout
.
expandToParentVerticallyWithPad
(
detailLabelContainer
!
,
child
:
detailLabel
!
,
top
:
verticalSpace
,
bottom
:
verticalSpace
)
detailLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(verticalSpace)-[detailLabel(<=maximumDetailLabelHeight)]-(verticalSpace)-|"
,
options
:
nil
,
metrics
:
[
"verticalSpace"
:
verticalSpace
,
"maximumDetailLabelHeight"
:
maximumDetailLabelHeight
],
views
:
[
"detailLabel"
:
detailLabel
!
])
)
Layout
.
expandToParentHorizontallyWithPad
(
detailLabelContainer
!
,
child
:
detailLabel
!
,
left
:
horizontalSpace
,
right
:
horizontalSpace
)
}
}
if
nil
!=
buttonsContainer
&&
(
nil
!=
leftButtons
||
nil
!=
rightButtons
)
{
if
nil
!=
buttonsContainer
&&
(
nil
!=
leftButtons
||
nil
!=
rightButtons
)
{
...
@@ -276,7 +280,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
...
@@ -276,7 +280,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
buttonsContainer
!.
addSubview
(
button
)
buttonsContainer
!.
addSubview
(
button
)
buttonViews
[
"button
\(
i
)
"
]
=
button
buttonViews
[
"button
\(
i
)
"
]
=
button
horizontalFormat
+=
"-(horizontalSpace)-[button
\(
i
)
]"
horizontalFormat
+=
"-(horizontalSpace)-[button
\(
i
)
]"
Layout
.
expandToParentVerticallyWithPad
(
buttonsContainer
!
,
child
:
button
,
top
:
horizontalSpace
,
bottom
:
verticalSpace
)
Layout
.
expandToParentVerticallyWithPad
(
buttonsContainer
!
,
child
:
button
,
top
:
verticalSpace
/
2
,
bottom
:
verticalSpace
/
2
)
}
}
buttonsContainer
!.
addConstraints
(
Layout
.
constraint
(
horizontalFormat
,
options
:
nil
,
metrics
:
[
"horizontalSpace"
:
horizontalSpace
],
views
:
buttonViews
))
buttonsContainer
!.
addConstraints
(
Layout
.
constraint
(
horizontalFormat
,
options
:
nil
,
metrics
:
[
"horizontalSpace"
:
horizontalSpace
],
views
:
buttonViews
))
}
}
...
@@ -290,7 +294,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
...
@@ -290,7 +294,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
buttonsContainer
!.
addSubview
(
button
)
buttonsContainer
!.
addSubview
(
button
)
buttonViews
[
"button
\(
i
)
"
]
=
button
buttonViews
[
"button
\(
i
)
"
]
=
button
horizontalFormat
+=
"[button
\(
i
)
]-(horizontalSpace)-"
horizontalFormat
+=
"[button
\(
i
)
]-(horizontalSpace)-"
Layout
.
expandToParentVerticallyWithPad
(
buttonsContainer
!
,
child
:
button
,
top
:
horizontalSpace
,
bottom
:
verticalSpace
)
Layout
.
expandToParentVerticallyWithPad
(
buttonsContainer
!
,
child
:
button
,
top
:
verticalSpace
/
2
,
bottom
:
verticalSpace
/
2
)
}
}
buttonsContainer
!.
addConstraints
(
Layout
.
constraint
(
horizontalFormat
+
"|"
,
options
:
nil
,
metrics
:
[
"horizontalSpace"
:
horizontalSpace
],
views
:
buttonViews
))
buttonsContainer
!.
addConstraints
(
Layout
.
constraint
(
horizontalFormat
+
"|"
,
options
:
nil
,
metrics
:
[
"horizontalSpace"
:
horizontalSpace
],
views
:
buttonViews
))
}
}
...
...
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