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
f65afdde
Commit
f65afdde
authored
Jan 02, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated MaterialLayer documentation and MaterialButton internals
parent
710ad186
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
113 additions
and
218 deletions
+113
-218
Examples/MaterialKit.xcworkspace/contents.xcworkspacedata
+1
-1
Examples/Programmatic/CardView/CardView.xcodeproj/project.pbxproj
+0
-6
Examples/Programmatic/MaterialLayer/MaterialLayer.xcodeproj/project.pbxproj
+6
-0
Examples/Storyboards/MaterialButton/MaterialButton/ViewController.swift
+1
-1
Sources/FabButton.swift
+9
-16
Sources/FlatButton.swift
+10
-17
Sources/MaterialButton.swift
+0
-0
Sources/MaterialLayer.swift
+72
-62
Sources/MaterialPulseView.swift
+3
-3
Sources/MaterialTheme.swift
+0
-95
Sources/RaisedButton.swift
+11
-17
No files found.
Examples/MaterialKit.xcworkspace/contents.xcworkspacedata
View file @
f65afdde
...
...
@@ -99,7 +99,7 @@
location =
"container:"
name =
"MaterialButton"
>
<FileRef
location =
"group:
/Users/danieldahan/Dropbox/GraphKit/Technology/Repositories/MaterialKit/Examples/
Storyboards/MaterialButton/MaterialButton.xcodeproj"
>
location =
"group:Storyboards/MaterialButton/MaterialButton.xcodeproj"
>
</FileRef>
</Group>
<Group
...
...
Examples/Programmatic/CardView/CardView.xcodeproj/project.pbxproj
View file @
f65afdde
...
...
@@ -7,8 +7,6 @@
objects
=
{
/* Begin PBXBuildFile section */
960B23541C3870A500E96216
/* MaterialKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
960B23531C3870A500E96216
/* MaterialKit.framework */
;
};
960B23551C3870A500E96216
/* MaterialKit.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
960B23531C3870A500E96216
/* MaterialKit.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
967513CA1C136BB7009F455A
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967513C91C136BB7009F455A
/* AppDelegate.swift */
;
};
967513CC1C136BB7009F455A
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967513CB1C136BB7009F455A
/* ViewController.swift */
;
};
967513D11C136BB7009F455A
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
967513D01C136BB7009F455A
/* Assets.xcassets */
;
};
...
...
@@ -22,7 +20,6 @@
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
960B23551C3870A500E96216
/* MaterialKit.framework in Embed Frameworks */
,
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -30,7 +27,6 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
960B23531C3870A500E96216
/* MaterialKit.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
name
=
MaterialKit.framework
;
path
=
"/Users/danieldahan/Library/Developer/Xcode/DerivedData/MaterialKit-gdulktuccbcfwbdfadtpxkworhyc/Build/Products/Debug-iphoneos/MaterialKit.framework"
;
sourceTree
=
"<absolute>"
;
};
967513C61C136BB7009F455A
/* CardView.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
CardView.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
967513C91C136BB7009F455A
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
967513CB1C136BB7009F455A
/* ViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ViewController.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -44,7 +40,6 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
960B23541C3870A500E96216
/* MaterialKit.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
@@ -54,7 +49,6 @@
967513BD1C136BB7009F455A
=
{
isa
=
PBXGroup
;
children
=
(
960B23531C3870A500E96216
/* MaterialKit.framework */
,
967513C81C136BB7009F455A
/* CardView */
,
967513C71C136BB7009F455A
/* Products */
,
);
...
...
Examples/Programmatic/MaterialLayer/MaterialLayer.xcodeproj/project.pbxproj
View file @
f65afdde
...
...
@@ -7,6 +7,8 @@
objects
=
{
/* Begin PBXBuildFile section */
9637EB0E1C387F08006D9677
/* MaterialKit.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9637EB0D1C387F08006D9677
/* MaterialKit.framework */
;
};
9637EB0F1C387F08006D9677
/* MaterialKit.framework in Embed Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9637EB0D1C387F08006D9677
/* MaterialKit.framework */
;
settings
=
{
ATTRIBUTES
=
(
CodeSignOnCopy
,
RemoveHeadersOnCopy
,
);
};
};
965E8E261C149B530035A270
/* AppDelegate.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965E8E251C149B530035A270
/* AppDelegate.swift */
;
};
965E8E281C149B530035A270
/* ViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965E8E271C149B530035A270
/* ViewController.swift */
;
};
965E8E2D1C149B530035A270
/* Assets.xcassets in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
965E8E2C1C149B530035A270
/* Assets.xcassets */
;
};
...
...
@@ -20,6 +22,7 @@
dstPath
=
""
;
dstSubfolderSpec
=
10
;
files
=
(
9637EB0F1C387F08006D9677
/* MaterialKit.framework in Embed Frameworks */
,
);
name
=
"Embed Frameworks"
;
runOnlyForDeploymentPostprocessing
=
0
;
...
...
@@ -27,6 +30,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
9637EB0D1C387F08006D9677
/* MaterialKit.framework */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.framework
;
name
=
MaterialKit.framework
;
path
=
"/Users/danieldahan/Library/Developer/Xcode/DerivedData/MaterialKit-gdulktuccbcfwbdfadtpxkworhyc/Build/Products/Debug-iphoneos/MaterialKit.framework"
;
sourceTree
=
"<absolute>"
;
};
965E8E221C149B530035A270
/* MaterialLayer.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
MaterialLayer.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
965E8E251C149B530035A270
/* AppDelegate.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
AppDelegate.swift
;
sourceTree
=
"<group>"
;
};
965E8E271C149B530035A270
/* ViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
ViewController.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -40,6 +44,7 @@
isa
=
PBXFrameworksBuildPhase
;
buildActionMask
=
2147483647
;
files
=
(
9637EB0E1C387F08006D9677
/* MaterialKit.framework in Frameworks */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
@@ -49,6 +54,7 @@
965E8E191C149B530035A270
=
{
isa
=
PBXGroup
;
children
=
(
9637EB0D1C387F08006D9677
/* MaterialKit.framework */
,
965E8E241C149B530035A270
/* MaterialLayer */
,
965E8E231C149B530035A270
/* Products */
,
);
...
...
Examples/Storyboards/MaterialButton/MaterialButton/ViewController.swift
View file @
f65afdde
...
...
@@ -49,7 +49,7 @@ class ViewController: UIViewController {
*/
func
prepareRaisedButtonExample
()
{
raisedButton
.
setTitle
(
"Raised"
,
forState
:
.
Normal
)
raisedButton
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
28
)
raisedButton
.
titleLabel
!.
font
=
RobotoFont
.
mediumWithSize
(
28
)
}
/**
...
...
Sources/FabButton.swift
View file @
f65afdde
...
...
@@ -20,24 +20,16 @@ import UIKit
public
class
FabButton
:
MaterialButton
{
/**
:name: prepareView
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
fabButton
.
titleLabelColorForNormalState
,
forState
:
.
Normal
)
titleLabel
?
.
font
=
MaterialTheme
.
fabButton
.
titleLabelFont
userInteractionEnabled
=
MaterialTheme
.
fabButton
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
fabButton
.
backgroundColor
pulseColorOpacity
=
MaterialTheme
.
fabButton
.
pulseColorOpacity
pulseColor
=
MaterialTheme
.
fabButton
.
pulseColor
depth
=
MaterialTheme
.
fabButton
.
depth
shadowColor
=
MaterialTheme
.
fabButton
.
shadowColor
zPosition
=
MaterialTheme
.
fabButton
.
zPosition
borderWidth
=
MaterialTheme
.
fabButton
.
borderWidth
borderColor
=
MaterialTheme
.
fabButton
.
bordercolor
contentInsets
=
MaterialTheme
.
fabButton
.
contentInsets
shape
=
MaterialTheme
.
fabButton
.
shape
backgroundColor
=
MaterialColor
.
red
.
darken1
depth
=
.
Depth2
shape
=
.
Circle
}
}
\ No newline at end of file
Sources/FlatButton.swift
View file @
f65afdde
...
...
@@ -20,25 +20,17 @@ import UIKit
public
class
FlatButton
:
MaterialButton
{
/**
:name: prepareView
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
flatButton
.
titleLabelColorForNormalState
,
forState
:
.
Normal
)
titleLabel
?
.
font
=
MaterialTheme
.
flatButton
.
titleLabelFont
userInteractionEnabled
=
MaterialTheme
.
flatButton
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
flatButton
.
backgroundColor
pulseColorOpacity
=
MaterialTheme
.
flatButton
.
pulseColorOpacity
pulseColor
=
MaterialTheme
.
flatButton
.
pulseColor
depth
=
MaterialTheme
.
flatButton
.
depth
shadowColor
=
MaterialTheme
.
flatButton
.
shadowColor
zPosition
=
MaterialTheme
.
flatButton
.
zPosition
cornerRadius
=
MaterialTheme
.
flatButton
.
cornerRadius
borderWidth
=
MaterialTheme
.
flatButton
.
borderWidth
borderColor
=
MaterialTheme
.
flatButton
.
bordercolor
contentInsets
=
MaterialTheme
.
flatButton
.
contentInsets
shape
=
MaterialTheme
.
flatButton
.
shape
setTitleColor
(
MaterialColor
.
blue
.
accent3
,
forState
:
.
Normal
)
pulseColor
=
MaterialColor
.
blue
.
accent3
cornerRadius
=
.
Radius1
contentInsets
=
.
WideRectangle3
}
}
\ No newline at end of file
Sources/MaterialButton.swift
View file @
f65afdde
This diff is collapsed.
Click to expand it.
Sources/MaterialLayer.swift
View file @
f65afdde
...
...
@@ -24,13 +24,14 @@ public protocol MaterialDelegate {}
@objc(MaterialLayer)
public
class
MaterialLayer
:
CAShapeLayer
{
/**
:name: visualLayer
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
public
private(set)
lazy
var
visualLayer
:
CAShapeLayer
=
CAShapeLayer
()
/**
:name: x
*/
/// A property that accesses the layer.frame.origin.x property.
public
var
x
:
CGFloat
{
get
{
return
frame
.
origin
.
x
...
...
@@ -40,9 +41,7 @@ public class MaterialLayer : CAShapeLayer {
}
}
/**
:name: y
*/
/// A property that accesses the layer.frame.origin.y property.
public
var
y
:
CGFloat
{
get
{
return
frame
.
origin
.
y
...
...
@@ -53,7 +52,10 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: width
A property that accesses the layer.frame.origin.width property.
When setting this property in conjunction with the shape property having a
value that is not .None, the height will be adjusted to maintain the correct
shape.
*/
public
var
width
:
CGFloat
{
get
{
...
...
@@ -68,7 +70,10 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: height
A property that accesses the layer.frame.origin.height property.
When setting this property in conjunction with the shape property having a
value that is not .None, the width will be adjusted to maintain the correct
shape.
*/
public
var
height
:
CGFloat
{
get
{
...
...
@@ -83,56 +88,51 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: image
A property that manages an image for the visualLayer's contents
property. Images should not be set to the backing layer's contents
property to avoid conflicts when using clipsToBounds.
*/
public
var
image
:
UIImage
?
{
get
{
return
nil
==
visualLayer
.
contents
?
nil
:
UIImage
(
CGImage
:
visualLayer
.
contents
as!
CGImageRef
)
}
set
(
value
)
{
visualLayer
.
contents
=
value
?
.
CGImage
didSet
{
visualLayer
.
contents
=
image
?
.
CGImage
}
}
/**
:name: contentsRect
Allows a relative subrectangle within the range of 0 to 1 to be
specified for the visualLayer's contents property. This allows
much greater flexibility than the contentsGravity property in
terms of how the image is cropped and stretched.
*/
public
override
var
contentsRect
:
CGRect
{
get
{
return
visualLayer
.
contentsRect
}
set
(
value
)
{
didSet
{
visualLayer
.
contentsRect
=
contentsRect
}
}
/**
:name: contentsCenter
A CGRect that defines a stretchable region inside the visualLayer
with a fixed border around the edge.
*/
public
override
var
contentsCenter
:
CGRect
{
get
{
return
visualLayer
.
contentsCenter
}
set
(
value
)
{
didSet
{
visualLayer
.
contentsCenter
=
contentsCenter
}
}
/**
:name: contentsScale
A floating point value that defines a ratio between the pixel
dimensions of the visualLayer's contents property and the size
of the layer. By default, this value is set to the UIScreen's
scale value, UIScreen.mainScreen().scale.
*/
public
override
var
contentsScale
:
CGFloat
{
get
{
return
visualLayer
.
contentsScale
}
set
(
value
)
{
didSet
{
visualLayer
.
contentsScale
=
contentsScale
}
}
/**
:name: contentsGravity
*/
/// Determines how content should be aligned within the visualLayer's bounds.
public
override
var
contentsGravity
:
String
{
get
{
return
visualLayer
.
contentsGravity
...
...
@@ -143,7 +143,9 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: depth
A property that sets the shadowOffset, shadowOpacity, and shadowRadius
for the backing layer. This is the preferred method of setting depth
in order to maintain consitency across UI objects.
*/
public
var
depth
:
MaterialDepth
{
didSet
{
...
...
@@ -155,7 +157,9 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: cornerRadius
A property that sets the cornerRadius of the backing layer. If the shape
property has a value of .Circle when the cornerRadius is set, it will
become .None, as it no longer maintains its circle shape.
*/
public
override
var
cornerRadius
:
CGFloat
{
didSet
{
...
...
@@ -166,22 +170,25 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: shape
A property that manages the overall shape for the object. If either the
width or height property is set, the other will be automatically adjusted
to maintain the shape of the object.
*/
public
var
shape
:
MaterialShape
{
didSet
{
if
.
None
!=
shape
{
if
width
<
height
{
width
=
height
frame
.
size
.
width
=
height
}
else
{
height
=
width
frame
.
size
.
height
=
width
}
}
}
}
/**
:name: init
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
shape
=
.
None
...
...
@@ -191,7 +198,9 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: init
An initializer the same as init(). The layer parameter is ignored
to avoid crashes on certain architectures.
- Parameter layer: AnyObject.
*/
public
override
init
(
layer
:
AnyObject
)
{
shape
=
.
None
...
...
@@ -200,9 +209,7 @@ public class MaterialLayer : CAShapeLayer {
prepareVisualLayer
()
}
/**
:name: init
*/
/// A convenience initializer.
public
override
init
()
{
shape
=
.
None
depth
=
.
None
...
...
@@ -211,7 +218,8 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: init
An initializer that initializes the object with a CGRect object.
- Parameter frame: A CGRect instance.
*/
public
convenience
init
(
frame
:
CGRect
)
{
self
.
init
()
...
...
@@ -225,7 +233,8 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: animate
A method that accepts CAAnimation objects and executes.
- Parameter animation: A CAAnimation instance.
*/
public
func
animate
(
animation
:
CAAnimation
)
{
animation
.
delegate
=
self
...
...
@@ -242,14 +251,21 @@ public class MaterialLayer : CAShapeLayer {
}
/**
:name: animationDidStart
A delegation method that is executed when the layer starts
running an animation.
- Parameter anim: The currently running CAAnimation instance.
*/
public
override
func
animationDidStart
(
anim
:
CAAnimation
)
{
(
delegate
as?
MaterialAnimationDelegate
)?
.
materialAnimationDidStart
?(
anim
)
}
/**
:name: animationDidStop
A delegation method that is executed when the layer stops
running an animation.
- Parameter anim: The CAAnimation instance that stopped running.
- Parameter flag: A boolean that indicates if the animation stopped
because it was completed or interrupted. True if completed, false
if interrupted.
*/
public
override
func
animationDidStop
(
anim
:
CAAnimation
,
finished
flag
:
Bool
)
{
if
let
a
:
CAPropertyAnimation
=
anim
as?
CAPropertyAnimation
{
...
...
@@ -268,9 +284,7 @@ public class MaterialLayer : CAShapeLayer {
layoutVisualLayer
()
}
/**
:name: prepareVisualLayer
*/
/// Prepares the visualLayer property.
public
func
prepareVisualLayer
()
{
// visualLayer
visualLayer
.
zPosition
=
0
...
...
@@ -278,21 +292,17 @@ public class MaterialLayer : CAShapeLayer {
addSublayer
(
visualLayer
)
}
/**
:name: layoutShape
*/
internal
func
layoutShape
()
{
if
.
Circle
==
shape
{
cornerRadius
=
width
/
2
}
}
/**
:name: layoutVisualLayer
*/
/// Manages the layout for the visualLayer property.
internal
func
layoutVisualLayer
()
{
visualLayer
.
frame
=
bounds
visualLayer
.
position
=
CGPointMake
(
width
/
2
,
height
/
2
)
visualLayer
.
cornerRadius
=
cornerRadius
}
/// Manages the layout for the shape of the layer instance.
internal
func
layoutShape
()
{
if
.
Circle
==
shape
{
cornerRadius
=
width
/
2
}
}
}
Sources/MaterialPulseView.swift
View file @
f65afdde
...
...
@@ -49,14 +49,14 @@ public class MaterialPulseView : MaterialView {
/// The opcaity value for the pulse animation.
public
var
pulseColorOpacity
:
CGFloat
=
0.25
{
didSet
{
update
d
PulseLayer
()
updatePulseLayer
()
}
}
/// The color of the pulse effect.
public
var
pulseColor
:
UIColor
?
{
didSet
{
update
d
PulseLayer
()
updatePulseLayer
()
}
}
...
...
@@ -154,7 +154,7 @@ public class MaterialPulseView : MaterialView {
}
/// Updates the pulseLayer when settings have changed.
internal
func
update
d
PulseLayer
()
{
internal
func
updatePulseLayer
()
{
pulseLayer
.
backgroundColor
=
pulseColor
?
.
colorWithAlphaComponent
(
pulseColorOpacity
)
.
CGColor
}
...
...
Sources/MaterialTheme.swift
View file @
f65afdde
...
...
@@ -25,9 +25,6 @@ public struct MaterialTheme {
public
struct
captureView
{}
public
struct
textLayer
{}
public
struct
label
{}
public
struct
flatButton
{}
public
struct
raisedButton
{}
public
struct
fabButton
{}
}
// basicCardView
...
...
@@ -208,95 +205,3 @@ public extension MaterialTheme.label {
public
static
var
font
:
UIFont
=
RobotoFont
.
regular
}
// flatButton
public
extension
MaterialTheme
.
flatButton
{
// shadow
public
static
var
depth
:
MaterialDepth
=
.
None
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
cornerRadius
:
MaterialRadius
=
.
Radius1
public
static
var
contentInsets
:
MaterialEdgeInsets
=
.
WideRectangle3
public
static
var
shape
:
MaterialShape
=
.
None
// border
public
static
var
borderWidth
:
MaterialBorder
=
.
None
public
static
var
bordercolor
:
UIColor
=
MaterialColor
.
black
// color
public
static
var
backgroundColor
:
UIColor
=
MaterialColor
.
clear
public
static
var
pulseColor
:
UIColor
=
MaterialColor
.
blue
.
accent3
public
static
var
pulseColorOpacity
:
CGFloat
=
0.25
public
static
var
titleLabelColorForNormalState
:
UIColor
=
MaterialColor
.
blue
.
accent3
// interaction
public
static
var
userInteractionEnabled
:
Bool
=
true
// position
public
static
var
zPosition
:
CGFloat
=
200
// font
public
static
var
titleLabelFont
:
UIFont
=
RobotoFont
.
regular
}
// raisedButton
public
extension
MaterialTheme
.
raisedButton
{
// shadow
public
static
var
depth
:
MaterialDepth
=
.
Depth2
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
cornerRadius
:
MaterialRadius
=
.
Radius1
public
static
var
contentInsets
:
MaterialEdgeInsets
=
.
WideRectangle2
public
static
var
shape
:
MaterialShape
=
.
None
// border
public
static
var
borderWidth
:
MaterialBorder
=
.
None
public
static
var
bordercolor
:
UIColor
=
MaterialColor
.
black
// color
public
static
var
backgroundColor
:
UIColor
=
MaterialColor
.
blue
.
accent3
public
static
var
pulseColor
:
UIColor
=
MaterialColor
.
white
public
static
var
pulseColorOpacity
:
CGFloat
=
0.25
public
static
var
titleLabelColorForNormalState
:
UIColor
=
MaterialColor
.
white
// interaction
public
static
var
userInteractionEnabled
:
Bool
=
true
// position
public
static
var
zPosition
:
CGFloat
=
200
// font
public
static
var
titleLabelFont
:
UIFont
=
RobotoFont
.
regular
}
// fabButton
public
extension
MaterialTheme
.
fabButton
{
// shadow
public
static
var
depth
:
MaterialDepth
=
.
Depth2
public
static
var
shadowColor
:
UIColor
=
MaterialColor
.
black
// shape
public
static
var
contentInsets
:
MaterialEdgeInsets
=
.
None
public
static
var
shape
:
MaterialShape
=
.
Circle
// border
public
static
var
borderWidth
:
MaterialBorder
=
.
None
public
static
var
bordercolor
:
UIColor
=
MaterialColor
.
black
// color
public
static
var
backgroundColor
:
UIColor
=
MaterialColor
.
red
.
darken1
public
static
var
pulseColor
:
UIColor
=
MaterialColor
.
white
public
static
var
pulseColorOpacity
:
CGFloat
=
0.25
public
static
var
titleLabelColorForNormalState
:
UIColor
=
MaterialColor
.
white
// interaction
public
static
var
userInteractionEnabled
:
Bool
=
true
// position
public
static
var
zPosition
:
CGFloat
=
200
// font
public
static
var
titleLabelFont
:
UIFont
=
RobotoFont
.
regular
}
Sources/RaisedButton.swift
View file @
f65afdde
...
...
@@ -20,25 +20,18 @@ import UIKit
public
class
RaisedButton
:
MaterialButton
{
/**
:name: prepareView
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
public
override
func
prepareView
()
{
super
.
prepareView
()
setTitleColor
(
MaterialTheme
.
raisedButton
.
titleLabelColorForNormalState
,
forState
:
.
Normal
)
titleLabel
!.
font
=
MaterialTheme
.
raisedButton
.
titleLabelFont
userInteractionEnabled
=
MaterialTheme
.
raisedButton
.
userInteractionEnabled
backgroundColor
=
MaterialTheme
.
raisedButton
.
backgroundColor
pulseColorOpacity
=
MaterialTheme
.
raisedButton
.
pulseColorOpacity
pulseColor
=
MaterialTheme
.
raisedButton
.
pulseColor
depth
=
MaterialTheme
.
raisedButton
.
depth
shadowColor
=
MaterialTheme
.
raisedButton
.
shadowColor
zPosition
=
MaterialTheme
.
raisedButton
.
zPosition
cornerRadius
=
MaterialTheme
.
raisedButton
.
cornerRadius
borderWidth
=
MaterialTheme
.
raisedButton
.
borderWidth
borderColor
=
MaterialTheme
.
raisedButton
.
bordercolor
contentInsets
=
MaterialTheme
.
raisedButton
.
contentInsets
shape
=
MaterialTheme
.
raisedButton
.
shape
setTitleColor
(
MaterialColor
.
white
,
forState
:
.
Normal
)
backgroundColor
=
MaterialColor
.
blue
.
accent3
depth
=
.
Depth2
cornerRadius
=
.
Radius1
contentInsets
=
.
WideRectangle3
}
}
\ No newline at end of file
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