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
13ec5abd
Commit
13ec5abd
authored
Sep 05, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixing Layout constraints on card with constructor paramaters
parent
a60c8773
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
25 deletions
+17
-25
Source/BasicCardView.swift
+12
-18
Source/ImageCardView.swift
+3
-3
Source/Layout.swift
+2
-4
No files found.
Source/BasicCardView.swift
View file @
13ec5abd
...
...
@@ -72,7 +72,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
t
.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
t
.
textColor
=
MaterialTheme
.
white
.
color
t
.
backgroundColor
=
MaterialTheme
.
clear
.
color
t
.
font
=
Roboto
.
medium
WithSize
(
18
)
t
.
font
=
Roboto
.
medium
t
.
numberOfLines
=
1
prepareCard
()
}
else
{
...
...
@@ -110,7 +110,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
l
.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
l
.
textColor
=
MaterialTheme
.
white
.
color
l
.
backgroundColor
=
MaterialTheme
.
clear
.
color
l
.
font
=
Roboto
.
light
WithSize
(
16
)
l
.
font
=
Roboto
.
light
l
.
numberOfLines
=
0
l
.
lineBreakMode
=
.
ByWordWrapping
prepareCard
()
...
...
@@ -161,7 +161,7 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
}
/**
:name: rightButtons
:name: rightButtons
*/
public
var
rightButtons
:
Array
<
MaterialButton
>
?
{
didSet
{
...
...
@@ -189,29 +189,16 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
/**
:name: init
*/
public
convenience
init
()
{
self
.
init
(
frame
:
CGRectZero
)
}
/**
:name: init
*/
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
.
titleLabel
=
titleLabel
self
.
detailLabel
=
detailLabel
self
.
leftButtons
=
leftButtons
self
.
rightButtons
=
rightButtons
prepareProperties
(
detailLabel
)
}
/**
:name: init
*/
public
required
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
if
CGRectZero
==
frame
{
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
}
super
.
init
(
frame
:
CGRectZero
)
}
//
...
...
@@ -224,6 +211,13 @@ public class BasicCardView : MaterialCardView, Comparable, Equatable {
}
//
// :name: prepareProperties
//
internal
func
prepareProperties
(
detailLabel
:
UILabel
?)
{
self
.
detailLabel
=
detailLabel
}
//
// :name: prepareCard
//
internal
override
func
prepareCard
()
{
...
...
Source/ImageCardView.swift
View file @
13ec5abd
...
...
@@ -113,7 +113,7 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
titleLabelContainer
!.
addSubview
(
t
)
t
.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
t
.
backgroundColor
=
MaterialTheme
.
clear
.
color
t
.
font
=
Roboto
.
medium
WithSize
(
18
)
t
.
font
=
Roboto
.
medium
t
.
numberOfLines
=
1
if
nil
==
imageView
{
titleLabelContainer
!.
backgroundColor
=
MaterialTheme
.
white
.
color
...
...
@@ -160,7 +160,7 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
l
.
setTranslatesAutoresizingMaskIntoConstraints
(
false
)
l
.
textColor
=
MaterialTheme
.
black
.
color
l
.
backgroundColor
=
MaterialTheme
.
clear
.
color
l
.
font
=
Roboto
.
light
WithSize
(
16
)
l
.
font
=
Roboto
.
light
l
.
numberOfLines
=
0
l
.
lineBreakMode
=
.
ByWordWrapping
prepareCard
()
...
...
@@ -192,7 +192,7 @@ public class ImageCardView : MaterialCardView, Comparable, Equatable {
public
private(set)
var
buttonsContainer
:
UIView
?
/**
:name: leftButtons
:name: leftButtons
*/
public
var
leftButtons
:
Array
<
MaterialButton
>
?
{
didSet
{
...
...
Source/Layout.swift
View file @
13ec5abd
...
...
@@ -132,12 +132,10 @@ public struct Layout {
}
/**
:name: alignAllSides
:name: alignAllSides
*/
public
static
func
alignAllSides
(
parent
:
UIView
,
child
:
UIView
)
{
let
views
:
Dictionary
<
String
,
AnyObject
>
=
[
"child"
:
child
]
parent
.
addConstraints
(
constraint
(
"H:|[child]|"
,
options
:
nil
,
metrics
:
nil
,
views
:
views
))
parent
.
addConstraints
(
constraint
(
"V:|[child]|"
,
options
:
nil
,
metrics
:
nil
,
views
:
views
))
expandToParent
(
parent
,
child
:
child
)
}
/**
...
...
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