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
ae77e281
Commit
ae77e281
authored
Aug 27, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue-17: minor updates
parent
62f91d73
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
38 deletions
+47
-38
Source/FlatButton.swift
+2
-35
Source/MaterialButton.swift
+10
-1
Source/RaisedButton.swift
+35
-2
No files found.
Source/FlatButton.swift
View file @
ae77e281
...
@@ -18,47 +18,14 @@
...
@@ -18,47 +18,14 @@
import
UIKit
import
UIKit
public
class
FlatButton
:
MaterialButton
{
public
class
FlatButton
:
RaisedButton
{
/**
:name: pulseTitleColor
*/
public
var
pulseTitleColor
:
UIColor
?
/**
:name: titleColor
*/
public
var
titleColor
:
UIColor
?
{
didSet
{
setTitleColor
(
titleColor
,
forState
:
.
Normal
)
}
}
//
//
// :name: prepareButton
// :name: prepareButton
//
//
internal
override
func
prepareButton
()
{
internal
override
func
prepareButton
()
{
super
.
prepareButton
()
super
.
prepareButton
()
backgroundColor
=
.
clearColor
()
pulseColor
=
.
whiteColor
()
pulseColor
=
.
whiteColor
()
backgroundColorView
.
layer
.
cornerRadius
=
3
backgroundColorView
.
layer
.
cornerRadius
=
3
}
}
//
// :name: pulseTouches
//
internal
override
func
pulseTouches
(
touches
:
Set
<
NSObject
>
)
{
super
.
pulseTouches
(
touches
)
UIView
.
animateWithDuration
(
0.3
,
animations
:
{
self
.
pulseView
!.
transform
=
CGAffineTransformMakeScale
(
10
,
10
)
self
.
transform
=
CGAffineTransformMakeScale
(
1.05
,
1.1
)
if
let
c
=
self
.
pulseTitleColor
{
self
.
setTitleColor
(
c
,
forState
:
.
Normal
)
}
})
{
_
in
if
let
c
=
self
.
titleColor
{
UIView
.
animateWithDuration
(
0.3
,
animations
:
{
self
.
setTitleColor
(
c
,
forState
:
.
Normal
)
})
}
}
}
}
}
Source/MaterialButton.swift
View file @
ae77e281
...
@@ -30,6 +30,15 @@ public class MaterialButton : UIButton {
...
@@ -30,6 +30,15 @@ public class MaterialButton : UIButton {
internal
var
pulseView
:
UIView
?
internal
var
pulseView
:
UIView
?
/**
/**
:name: backgroundColor
*/
public
override
var
backgroundColor
:
UIColor
?
{
didSet
{
backgroundColorView
.
backgroundColor
=
backgroundColor
}
}
/**
:name: pulseColor
:name: pulseColor
*/
*/
public
var
pulseColor
:
UIColor
?
public
var
pulseColor
:
UIColor
?
...
@@ -120,8 +129,8 @@ public class MaterialButton : UIButton {
...
@@ -120,8 +129,8 @@ public class MaterialButton : UIButton {
// We need this view so we can use the masksToBounds
// We need this view so we can use the masksToBounds
// so the pulse doesn't animate off the button
// so the pulse doesn't animate off the button
private
func
prepareBackgroundColorView
()
{
private
func
prepareBackgroundColorView
()
{
backgroundColorView
.
backgroundColor
=
backgroundColor
backgroundColorView
.
layer
.
masksToBounds
=
true
backgroundColorView
.
layer
.
masksToBounds
=
true
backgroundColorView
.
clipsToBounds
=
true
backgroundColorView
.
userInteractionEnabled
=
false
backgroundColorView
.
userInteractionEnabled
=
false
insertSubview
(
backgroundColorView
,
atIndex
:
0
)
insertSubview
(
backgroundColorView
,
atIndex
:
0
)
}
}
...
...
Source/RaisedButton.swift
View file @
ae77e281
...
@@ -18,15 +18,48 @@
...
@@ -18,15 +18,48 @@
import
UIKit
import
UIKit
public
class
RaisedButton
:
FlatButton
{
public
class
RaisedButton
:
MaterialButton
{
/**
:name: pulseTitleColor
*/
public
var
pulseTitleColor
:
UIColor
?
/**
:name: titleColor
*/
public
var
titleColor
:
UIColor
?
{
didSet
{
setTitleColor
(
titleColor
,
forState
:
.
Normal
)
}
}
//
//
// :name: prepareButton
// :name: prepareButton
//
//
internal
override
func
prepareButton
()
{
internal
override
func
prepareButton
()
{
super
.
prepareButton
()
super
.
prepareButton
()
backgroundColor
=
.
redColor
()
pulseColor
=
.
whiteColor
()
pulseColor
=
.
whiteColor
()
backgroundColorView
.
layer
.
cornerRadius
=
3
backgroundColorView
.
layer
.
cornerRadius
=
3
}
}
//
// :name: pulseTouches
//
internal
override
func
pulseTouches
(
touches
:
Set
<
NSObject
>
)
{
super
.
pulseTouches
(
touches
)
UIView
.
animateWithDuration
(
0.3
,
animations
:
{
self
.
pulseView
!.
transform
=
CGAffineTransformMakeScale
(
10
,
10
)
self
.
transform
=
CGAffineTransformMakeScale
(
1.05
,
1.1
)
if
let
c
=
self
.
pulseTitleColor
{
self
.
setTitleColor
(
c
,
forState
:
.
Normal
)
}
})
{
_
in
if
let
c
=
self
.
titleColor
{
UIView
.
animateWithDuration
(
0.3
,
animations
:
{
self
.
setTitleColor
(
c
,
forState
:
.
Normal
)
})
}
}
}
}
}
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