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
8c80c41e
Commit
8c80c41e
authored
Sep 26, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merging files and removing Base file on previous revert
parent
1b8a923d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
83 deletions
+0
-83
Sources/iOS/Base.swift
+0
-83
No files found.
Sources/iOS/Base.swift
deleted
100644 → 0
View file @
1b8a923d
//
// Base.swift
// Material
//
// Created by Orkhan Alikhanov on 8/29/17.
// Copyright © 2017 BiAtoms. All rights reserved.
//
import
UIKit
class
Base
:
UIControl
{
let
titleLabel
=
UILabel
()
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
prepare
()
}
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
prepare
()
}
let
iconLayer
=
CALayer
()
var
selectedColor
=
UIColor
(
red
:
0.25
,
green
:
0.32
,
blue
:
0.71
,
alpha
:
1.0
)
var
normalColor
=
UIColor
.
gray
func
prepare
()
{
layer
.
addSublayer
(
iconLayer
)
self
.
addTarget
(
self
,
action
:
#selector(
didTap
)
,
for
:
.
touchUpInside
)
beforeFirstAnimation
()
firstAnimation
()
beforeSecondAnimation
()
secondAnimation
()
}
@objc
func
didTap
()
{
self
.
isSelected
=
!
self
.
isSelected
self
.
animate
()
}
var
sideLength
:
CGFloat
{
return
frame
.
height
}
override
var
intrinsicContentSize
:
CGSize
{
return
CGSize
(
width
:
132
,
height
:
132
)
}
func
beforeFirstAnimation
()
{}
func
firstAnimation
()
{}
func
beforeSecondAnimation
()
{}
func
secondAnimation
()
{}
var
isAnimating
=
false
let
totalDuration
:
TimeInterval
=
0.5
let
delayFactor
:
TimeInterval
=
0.33
var
duration
:
TimeInterval
{
return
totalDuration
/
(
1.0
+
delayFactor
+
1.0
)
}
func
animate
()
{
beforeFirstAnimation
()
CATransaction
.
animate
(
withDuration
:
duration
,
timingFunction
:
.
easeInOut
,
animations
:
{
self
.
isAnimating
=
true
self
.
firstAnimation
()
})
{
CATransaction
.
performWithoutAnimation
{
self
.
beforeSecondAnimation
()
}
CATransaction
.
animate
(
withDuration
:
self
.
duration
,
delay
:
self
.
duration
*
self
.
delayFactor
,
timingFunction
:
.
easeInOut
,
animations
:
{
self
.
secondAnimation
()
},
completion
:
{
self
.
isAnimating
=
false
})
}
}
override
func
layoutSubviews
()
{
super
.
layoutSubviews
()
let
size
=
CGSize
(
width
:
sideLength
,
height
:
sideLength
)
self
.
iconLayer
.
frame
.
size
=
size
}
}
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