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
a5d3a705
Commit
a5d3a705
authored
Sep 27, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added visualLayer
parent
edfbcb3f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
140 additions
and
16 deletions
+140
-16
MaterialKit.xcodeproj/project.pbxproj
+24
-0
Source/MaterialAnimation.swift
+43
-0
Source/MaterialLabel.swift
+29
-0
Source/MaterialPulseView.swift
+11
-4
Source/MaterialView.swift
+33
-12
No files found.
MaterialKit.xcodeproj/project.pbxproj
View file @
a5d3a705
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
65BDD16A1BB7146B006F7F2B
/* MaterialBorder.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD16A1BB7146B006F7F2B
/* MaterialBorder.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD16C1BB88D1A006F7F2B
/* MaterialShape.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD16B1BB88D1A006F7F2B
/* MaterialShape.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD16C1BB88D1A006F7F2B
/* MaterialShape.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD16B1BB88D1A006F7F2B
/* MaterialShape.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD16E1BB899F2006F7F2B
/* MaterialPulseView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD16D1BB899F2006F7F2B
/* MaterialPulseView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD16E1BB899F2006F7F2B
/* MaterialPulseView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD16D1BB899F2006F7F2B
/* MaterialPulseView.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1721BB8CD77006F7F2B
/* MaterialLabel.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1711BB8CD77006F7F2B
/* MaterialLabel.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65BDD1741BB8D443006F7F2B
/* MaterialAnimation.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65BDD1731BB8D443006F7F2B
/* MaterialAnimation.swift */
;
settings
=
{
ASSET_TAGS
=
();
};
};
65DBE4201B9A9244000C804F
/* Roboto-Bold.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
;
};
65DBE4201B9A9244000C804F
/* Roboto-Bold.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
;
};
65DBE4211B9A9244000C804F
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
;
};
65DBE4211B9A9244000C804F
/* Roboto-Thin.ttf in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
;
};
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
;
};
962F3E531BACA68C0004B8AD
/* NavigationBarView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
;
};
...
@@ -69,6 +71,8 @@
...
@@ -69,6 +71,8 @@
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialBorder.swift
;
sourceTree
=
"<group>"
;
};
65BDD1691BB7146B006F7F2B
/* MaterialBorder.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialBorder.swift
;
sourceTree
=
"<group>"
;
};
65BDD16B1BB88D1A006F7F2B
/* MaterialShape.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialShape.swift
;
sourceTree
=
"<group>"
;
};
65BDD16B1BB88D1A006F7F2B
/* MaterialShape.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialShape.swift
;
sourceTree
=
"<group>"
;
};
65BDD16D1BB899F2006F7F2B
/* MaterialPulseView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialPulseView.swift
;
sourceTree
=
"<group>"
;
};
65BDD16D1BB899F2006F7F2B
/* MaterialPulseView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialPulseView.swift
;
sourceTree
=
"<group>"
;
};
65BDD1711BB8CD77006F7F2B
/* MaterialLabel.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialLabel.swift
;
sourceTree
=
"<group>"
;
};
65BDD1731BB8D443006F7F2B
/* MaterialAnimation.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
MaterialAnimation.swift
;
sourceTree
=
"<group>"
;
};
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Bold.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41E1B9A9244000C804F
/* Roboto-Bold.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Bold.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Thin.ttf"
;
sourceTree
=
"<group>"
;
};
65DBE41F1B9A9244000C804F
/* Roboto-Thin.ttf */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
file
;
path
=
"Roboto-Thin.ttf"
;
sourceTree
=
"<group>"
;
};
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationBarView.swift
;
sourceTree
=
"<group>"
;
};
962F3E521BACA68C0004B8AD
/* NavigationBarView.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationBarView.swift
;
sourceTree
=
"<group>"
;
};
...
@@ -141,6 +145,22 @@
...
@@ -141,6 +145,22 @@
name
=
Navigation
;
name
=
Navigation
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
};
};
65BDD1701BB8CD56006F7F2B
/* Label */
=
{
isa
=
PBXGroup
;
children
=
(
65BDD1711BB8CD77006F7F2B
/* MaterialLabel.swift */
,
);
name
=
Label
;
sourceTree
=
"<group>"
;
};
65BDD1751BB8D44B006F7F2B
/* Animation */
=
{
isa
=
PBXGroup
;
children
=
(
65BDD1731BB8D443006F7F2B
/* MaterialAnimation.swift */
,
);
name
=
Animation
;
sourceTree
=
"<group>"
;
};
9638322C1B88DFD80015F710
=
{
9638322C1B88DFD80015F710
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
...
@@ -168,7 +188,9 @@
...
@@ -168,7 +188,9 @@
9AAC38521B89553800FE6B2D
/* Font */
,
9AAC38521B89553800FE6B2D
/* Font */
,
65B965851B8BEEB00055B139
/* View */
,
65B965851B8BEEB00055B139
/* View */
,
65BDD16F1BB89A01006F7F2B
/* Navigation */
,
65BDD16F1BB89A01006F7F2B
/* Navigation */
,
65BDD1701BB8CD56006F7F2B
/* Label */
,
65BDD1551BB6FC60006F7F2B
/* Button */
,
65BDD1551BB6FC60006F7F2B
/* Button */
,
65BDD1751BB8D44B006F7F2B
/* Animation */
,
);
);
path
=
Source
;
path
=
Source
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -358,9 +380,11 @@
...
@@ -358,9 +380,11 @@
65BDD1541BB6F473006F7F2B
/* MaterialShadow.swift in Sources */
,
65BDD1541BB6F473006F7F2B
/* MaterialShadow.swift in Sources */
,
65BDD1571BB6FC82006F7F2B
/* MaterialButton.swift in Sources */
,
65BDD1571BB6FC82006F7F2B
/* MaterialButton.swift in Sources */
,
65BDD16E1BB899F2006F7F2B
/* MaterialPulseView.swift in Sources */
,
65BDD16E1BB899F2006F7F2B
/* MaterialPulseView.swift in Sources */
,
65BDD1741BB8D443006F7F2B
/* MaterialAnimation.swift in Sources */
,
65BDD14B1BB5DD02006F7F2B
/* MaterialFont.swift in Sources */
,
65BDD14B1BB5DD02006F7F2B
/* MaterialFont.swift in Sources */
,
65BDD16A1BB7146B006F7F2B
/* MaterialBorder.swift in Sources */
,
65BDD16A1BB7146B006F7F2B
/* MaterialBorder.swift in Sources */
,
65BDD15B1BB7095E006F7F2B
/* MaterialRadius.swift in Sources */
,
65BDD15B1BB7095E006F7F2B
/* MaterialRadius.swift in Sources */
,
65BDD1721BB8CD77006F7F2B
/* MaterialLabel.swift in Sources */
,
65BDD1491BB5DC98006F7F2B
/* MaterialColor.swift in Sources */
,
65BDD1491BB5DC98006F7F2B
/* MaterialColor.swift in Sources */
,
65BDD14D1BB5ED9F006F7F2B
/* MaterialTheme.swift in Sources */
,
65BDD14D1BB5ED9F006F7F2B
/* MaterialTheme.swift in Sources */
,
);
);
...
...
Source/MaterialAnimation.swift
0 → 100644
View file @
a5d3a705
//
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import
UIKit
public
struct
MaterialAnimation
{
/**
:name: rotate
*/
public
static
func
rotate
(
layer
:
CALayer
,
duration
:
CFTimeInterval
,
completion
:
(()
->
Void
)?
=
nil
)
{
CATransaction
.
begin
()
CATransaction
.
setAnimationDuration
(
duration
)
let
transform
:
CGAffineTransform
=
CGAffineTransformRotate
(
layer
.
affineTransform
(),
CGFloat
(
M_PI
))
layer
.
setAffineTransform
(
transform
)
CATransaction
.
setCompletionBlock
(
completion
)
CATransaction
.
commit
()
}
/**
:name: pulse
*/
public
static
func
pulse
(
layer
:
CALayer
,
duraction
:
CFTimeInterval
,
completion
:
(()
->
Void
)?
=
nil
)
{
CATransaction
.
begin
()
CATransaction
.
setAnimationDuration
(
1.0
)
CATransaction
.
commit
()
}
}
Source/MaterialLabel.swift
0 → 100644
View file @
a5d3a705
//
// Copyright (C) 2015 GraphKit, Inc. <http://graphkit.io> and other GraphKit contributors.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program located at the root of the software package
// in a file called LICENSE. If not, see <http://www.gnu.org/licenses/>.
//
import
UIKit
public
class
MaterialLabel
:
UILabel
{
/**
:name: layerClass
*/
public
override
class
func
layerClass
()
->
AnyClass
{
return
CATextLayer
.
self
}
}
\ No newline at end of file
Source/MaterialPulseView.swift
View file @
a5d3a705
...
@@ -73,7 +73,7 @@ public class MaterialPulseView: MaterialView {
...
@@ -73,7 +73,7 @@ public class MaterialPulseView: MaterialView {
//
//
// :name: pulseLayer
// :name: pulseLayer
//
//
internal
lazy
var
pulseLayer
:
CA
Layer
=
CA
Layer
()
internal
lazy
var
pulseLayer
:
CA
ShapeLayer
=
CAShape
Layer
()
/**
/**
:name: init
:name: init
...
@@ -87,7 +87,11 @@ public class MaterialPulseView: MaterialView {
...
@@ -87,7 +87,11 @@ public class MaterialPulseView: MaterialView {
*/
*/
public
override
func
touchesBegan
(
touches
:
Set
<
UITouch
>
,
withEvent
event
:
UIEvent
?)
{
public
override
func
touchesBegan
(
touches
:
Set
<
UITouch
>
,
withEvent
event
:
UIEvent
?)
{
super
.
touchesBegan
(
touches
,
withEvent
:
event
)
super
.
touchesBegan
(
touches
,
withEvent
:
event
)
layer
.
addSublayer
(
pulseLayer
)
// pulseLayer.hidden = false
// let point: CGPoint = touches.first!.locationInView(self)
// let pulse: CAShapeLayer = CAShapeLayer()
// pulse.bounds = CGRectMake(point.x, point.y, 0, 0)
// pulse.backgroundColor = MaterialColor.white.CGColor
}
}
/**
/**
...
@@ -95,7 +99,8 @@ public class MaterialPulseView: MaterialView {
...
@@ -95,7 +99,8 @@ public class MaterialPulseView: MaterialView {
*/
*/
public
override
func
touchesEnded
(
touches
:
Set
<
UITouch
>
,
withEvent
event
:
UIEvent
?)
{
public
override
func
touchesEnded
(
touches
:
Set
<
UITouch
>
,
withEvent
event
:
UIEvent
?)
{
super
.
touchesEnded
(
touches
,
withEvent
:
event
)
super
.
touchesEnded
(
touches
,
withEvent
:
event
)
pulseLayer
.
removeFromSuperlayer
()
// pulseLayer.hidden = true
MaterialAnimation
.
rotate
(
visualLayer
,
duration
:
1
)
}
}
/**
/**
...
@@ -134,7 +139,9 @@ public class MaterialPulseView: MaterialView {
...
@@ -134,7 +139,9 @@ public class MaterialPulseView: MaterialView {
// pulseLayer
// pulseLayer
pulseLayer
.
frame
=
CGRectMake
(
0
,
0
,
width
,
height
)
pulseLayer
.
frame
=
CGRectMake
(
0
,
0
,
width
,
height
)
pulseLayer
.
masksToBounds
=
true
pulseLayer
.
masksToBounds
=
true
pulseLayer
.
backgroundColor
=
MaterialColor
.
blue
.
accent3
.
CGColor
pulseLayer
.
hidden
=
true
pulseLayer
.
backgroundColor
=
MaterialColor
.
red
.
base
.
CGColor
visualLayer
.
addSublayer
(
pulseLayer
)
}
}
//
//
...
...
Source/MaterialView.swift
View file @
a5d3a705
...
@@ -19,12 +19,17 @@
...
@@ -19,12 +19,17 @@
import
UIKit
import
UIKit
public
class
MaterialView
:
UIView
{
public
class
MaterialView
:
UIView
{
//
// :name: visualLayer
//
public
private(set)
lazy
var
visualLayer
:
CAShapeLayer
=
CAShapeLayer
()
/**
/**
:name: image
:name: image
*/
*/
public
var
image
:
UIImage
?
{
public
var
image
:
UIImage
?
{
didSet
{
didSet
{
l
ayer
.
contents
=
image
?
.
CGImage
visualL
ayer
.
contents
=
image
?
.
CGImage
}
}
}
}
...
@@ -33,7 +38,7 @@ public class MaterialView: UIView {
...
@@ -33,7 +38,7 @@ public class MaterialView: UIView {
*/
*/
public
var
contentsRect
:
CGRect
!
{
public
var
contentsRect
:
CGRect
!
{
didSet
{
didSet
{
l
ayer
.
contentsRect
=
contentsRect
visualL
ayer
.
contentsRect
=
contentsRect
}
}
}
}
...
@@ -42,7 +47,7 @@ public class MaterialView: UIView {
...
@@ -42,7 +47,7 @@ public class MaterialView: UIView {
*/
*/
public
var
contentsCenter
:
CGRect
!
{
public
var
contentsCenter
:
CGRect
!
{
didSet
{
didSet
{
l
ayer
.
contentsCenter
=
contentsCenter
visualL
ayer
.
contentsCenter
=
contentsCenter
}
}
}
}
...
@@ -51,7 +56,7 @@ public class MaterialView: UIView {
...
@@ -51,7 +56,7 @@ public class MaterialView: UIView {
*/
*/
public
var
contentsScale
:
CGFloat
!
{
public
var
contentsScale
:
CGFloat
!
{
didSet
{
didSet
{
l
ayer
.
contentsScale
=
contentsScale
visualL
ayer
.
contentsScale
=
contentsScale
}
}
}
}
...
@@ -60,7 +65,7 @@ public class MaterialView: UIView {
...
@@ -60,7 +65,7 @@ public class MaterialView: UIView {
*/
*/
public
var
contentsGravity
:
MaterialGravity
!
{
public
var
contentsGravity
:
MaterialGravity
!
{
didSet
{
didSet
{
l
ayer
.
contentsGravity
=
MaterialGravityToString
(
contentsGravity
)
visualL
ayer
.
contentsGravity
=
MaterialGravityToString
(
contentsGravity
)
}
}
}
}
...
@@ -69,10 +74,10 @@ public class MaterialView: UIView {
...
@@ -69,10 +74,10 @@ public class MaterialView: UIView {
*/
*/
public
override
var
backgroundColor
:
UIColor
?
{
public
override
var
backgroundColor
:
UIColor
?
{
get
{
get
{
return
nil
==
layer
.
backgroundColor
?
nil
:
UIColor
(
CGColor
:
l
ayer
.
backgroundColor
!
)
return
nil
==
visualLayer
.
backgroundColor
?
nil
:
UIColor
(
CGColor
:
visualL
ayer
.
backgroundColor
!
)
}
}
set
(
value
)
{
set
(
value
)
{
l
ayer
.
backgroundColor
=
value
?
.
CGColor
visualL
ayer
.
backgroundColor
=
value
?
.
CGColor
}
}
}
}
...
@@ -109,6 +114,7 @@ public class MaterialView: UIView {
...
@@ -109,6 +114,7 @@ public class MaterialView: UIView {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
width
=
value
layer
.
frame
.
size
.
width
=
value
visualLayer
.
frame
.
size
.
width
=
value
prepareShape
()
prepareShape
()
}
}
}
}
...
@@ -122,6 +128,7 @@ public class MaterialView: UIView {
...
@@ -122,6 +128,7 @@ public class MaterialView: UIView {
}
}
set
(
value
)
{
set
(
value
)
{
layer
.
frame
.
size
.
height
=
value
layer
.
frame
.
size
.
height
=
value
visualLayer
.
frame
.
size
.
height
=
value
prepareShape
()
prepareShape
()
}
}
}
}
...
@@ -167,7 +174,7 @@ public class MaterialView: UIView {
...
@@ -167,7 +174,7 @@ public class MaterialView: UIView {
*/
*/
public
var
masksToBounds
:
Bool
!
{
public
var
masksToBounds
:
Bool
!
{
didSet
{
didSet
{
l
ayer
.
masksToBounds
=
masksToBounds
visualL
ayer
.
masksToBounds
=
masksToBounds
}
}
}
}
...
@@ -176,7 +183,7 @@ public class MaterialView: UIView {
...
@@ -176,7 +183,7 @@ public class MaterialView: UIView {
*/
*/
public
var
cornerRadius
:
MaterialRadius
!
{
public
var
cornerRadius
:
MaterialRadius
!
{
didSet
{
didSet
{
l
ayer
.
cornerRadius
=
MaterialRadiusToValue
(
cornerRadius
!
)
visualL
ayer
.
cornerRadius
=
MaterialRadiusToValue
(
cornerRadius
!
)
}
}
}
}
...
@@ -194,7 +201,7 @@ public class MaterialView: UIView {
...
@@ -194,7 +201,7 @@ public class MaterialView: UIView {
*/
*/
public
var
borderWidth
:
MaterialBorder
!
{
public
var
borderWidth
:
MaterialBorder
!
{
didSet
{
didSet
{
l
ayer
.
borderWidth
=
MaterialBorderToValue
(
borderWidth
!
)
visualL
ayer
.
borderWidth
=
MaterialBorderToValue
(
borderWidth
!
)
}
}
}
}
...
@@ -203,7 +210,7 @@ public class MaterialView: UIView {
...
@@ -203,7 +210,7 @@ public class MaterialView: UIView {
*/
*/
public
var
borderColor
:
UIColor
!
{
public
var
borderColor
:
UIColor
!
{
didSet
{
didSet
{
l
ayer
.
borderColor
=
borderColor
.
CGColor
visualL
ayer
.
borderColor
=
borderColor
.
CGColor
}
}
}
}
...
@@ -251,6 +258,13 @@ public class MaterialView: UIView {
...
@@ -251,6 +258,13 @@ public class MaterialView: UIView {
self
.
init
(
frame
:
CGRectMake
(
MaterialTheme
.
view
.
x
,
MaterialTheme
.
view
.
y
,
MaterialTheme
.
view
.
width
,
MaterialTheme
.
view
.
height
))
self
.
init
(
frame
:
CGRectMake
(
MaterialTheme
.
view
.
x
,
MaterialTheme
.
view
.
y
,
MaterialTheme
.
view
.
width
,
MaterialTheme
.
view
.
height
))
}
}
/**
:name: layerClass
*/
public
override
class
func
layerClass
()
->
AnyClass
{
return
CAShapeLayer
.
self
}
//
//
// :name: prepareView
// :name: prepareView
//
//
...
@@ -274,6 +288,10 @@ public class MaterialView: UIView {
...
@@ -274,6 +288,10 @@ public class MaterialView: UIView {
cornerRadius
=
MaterialTheme
.
view
.
cornerRadius
cornerRadius
=
MaterialTheme
.
view
.
cornerRadius
borderWidth
=
MaterialTheme
.
view
.
borderWidth
borderWidth
=
MaterialTheme
.
view
.
borderWidth
borderColor
=
MaterialTheme
.
view
.
bordercolor
borderColor
=
MaterialTheme
.
view
.
bordercolor
// visualLayer
visualLayer
.
frame
=
CGRectMake
(
0
,
0
,
width
,
height
)
layer
.
addSublayer
(
visualLayer
)
}
}
//
//
...
@@ -283,10 +301,13 @@ public class MaterialView: UIView {
...
@@ -283,10 +301,13 @@ public class MaterialView: UIView {
if
nil
!=
shape
{
if
nil
!=
shape
{
if
width
<
height
{
if
width
<
height
{
layer
.
frame
.
size
.
width
=
height
layer
.
frame
.
size
.
width
=
height
visualLayer
.
frame
.
size
.
width
=
height
}
else
{
}
else
{
layer
.
frame
.
size
.
height
=
width
layer
.
frame
.
size
.
height
=
width
visualLayer
.
frame
.
size
.
height
=
width
}
}
layer
.
cornerRadius
=
.
Square
==
shape
?
0
:
width
/
2
layer
.
cornerRadius
=
.
Square
==
shape
?
0
:
layer
.
frame
.
size
.
width
/
2
visualLayer
.
cornerRadius
=
layer
.
cornerRadius
}
}
}
}
}
}
...
...
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