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
d24172ff
Commit
d24172ff
authored
Aug 31, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added shadow check
parent
143c0f39
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletions
+34
-1
Source/BasicCard.swift
+10
-1
Source/Layout.swift
+14
-0
Source/MaterialCard.swift
+10
-0
No files found.
Source/BasicCard.swift
View file @
d24172ff
...
...
@@ -45,6 +45,15 @@ public class BasicCard : MaterialCard {
public
private(set)
var
titleLabelContainer
:
UIView
?
/**
:name: shadow
*/
public
var
shadow
:
Bool
=
true
{
didSet
{
false
==
shadow
?
removeShadow
()
:
prepareShadow
()
}
}
/**
:name: titleLabel
*/
public
var
titleLabel
:
UILabel
?
{
...
...
@@ -175,7 +184,7 @@ public class BasicCard : MaterialCard {
// text
titleLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"H:|-(verticalSpace)-[titleLabel]-(verticalSpace)-|"
,
options
:
nil
,
metrics
:
[
"verticalSpace"
:
verticalSpace
],
views
:
[
"titleLabel"
:
titleLabel
!
]))
titleLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(verticalSpace)-[titleLabel
]-(verticalSpace)-|"
,
options
:
nil
,
metrics
:
[
"verticalSpace"
:
verticalSpac
e
],
views
:
[
"titleLabel"
:
titleLabel
!
]))
titleLabelContainer
!.
addConstraints
(
Layout
.
constraint
(
"V:|-(verticalSpace)-[titleLabel
(height)]-(verticalSpace)-|"
,
options
:
nil
,
metrics
:
[
"verticalSpace"
:
verticalSpace
,
"height"
:
titleLabel
!.
font
.
pointSiz
e
],
views
:
[
"titleLabel"
:
titleLabel
!
]))
}
// detail
...
...
Source/Layout.swift
View file @
d24172ff
...
...
@@ -55,6 +55,13 @@ public struct Layout {
}
/**
:name: expandToParentHorizontally
*/
public
static
func
expandToParentHorizontally
(
parent
:
UIView
,
child
:
UIView
)
{
expandToParentHorizontallyWithPad
(
parent
,
child
:
child
,
left
:
0
,
right
:
0
)
}
/**
:name: expandToParentHorizontallyWithPad
*/
public
static
func
expandToParentHorizontallyWithPad
(
parent
:
UIView
,
child
:
UIView
,
left
:
CGFloat
=
0
,
right
:
CGFloat
=
0
)
{
...
...
@@ -62,6 +69,13 @@ public struct Layout {
}
/**
:name: expandToParentVertically
*/
public
static
func
expandToParentVertically
(
parent
:
UIView
,
child
:
UIView
)
{
expandToParentVerticallyWithPad
(
parent
,
child
:
child
,
top
:
0
,
bottom
:
0
)
}
/**
:name: expandToParentVerticallyWithPad
*/
public
static
func
expandToParentVerticallyWithPad
(
parent
:
UIView
,
child
:
UIView
,
top
:
CGFloat
=
0
,
bottom
:
CGFloat
=
0
)
{
...
...
Source/MaterialCard.swift
View file @
d24172ff
...
...
@@ -120,6 +120,16 @@ public class MaterialCard : UIView {
}
//
// :name: removeShadow
//
internal
func
removeShadow
()
{
layer
.
shadowColor
=
MaterialTheme
.
clear
.
color
.
CGColor
layer
.
shadowOffset
=
CGSizeMake
(
0
,
0
)
layer
.
shadowOpacity
=
0
layer
.
shadowRadius
=
0
}
//
// :name: layoutSubviews
//
public
override
func
layoutSubviews
()
{
...
...
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