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
4ff9db52
Commit
4ff9db52
authored
Sep 25, 2018
by
Orkhan Alikhanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added interactive line transition methods for tabBar
parent
cbd13228
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
Sources/iOS/TabBar.swift
+50
-0
No files found.
Sources/iOS/TabBar.swift
View file @
4ff9db52
...
...
@@ -29,6 +29,7 @@
*/
import
UIKit
import
Motion
open
class
TabItem
:
FlatButton
{
/// A dictionary of TabItemStates to UIColors for states.
...
...
@@ -574,6 +575,55 @@ extension TabBar {
}
}
internal
extension
TabBar
{
/**
Starts line transition for the index with the given duration.
- Parameter for index: An Int.
- Parameter duration: A TimeInterval.
*/
func
startLineTransition
(
for
index
:
Int
,
duration
:
TimeInterval
=
0.35
)
{
guard
let
s
=
selectedTabItem
,
let
currentIndex
=
tabItems
.
firstIndex
(
of
:
s
)
else
{
return
}
guard
currentIndex
!=
index
else
{
return
}
let
targetFrame
=
lineFrame
(
for
:
tabItems
[
index
],
forMotion
:
true
)
line
.
transition
(
.
size
(
targetFrame
.
size
),
.
position
(
targetFrame
.
origin
),
.
duration
(
duration
))
line
.
motionViewTransition
.
start
()
}
/**
Updates line transition to the given progress value.
- Parameter _ progress: A CGFloat.
*/
func
updateLineTransition
(
_
progress
:
CGFloat
)
{
line
.
motionViewTransition
.
update
(
progress
)
}
/**
Finishes line transition.
- Parameter isAnimated: A Boolean indicating if the change should be animated.
*/
func
finishLineTransition
(
isAnimated
:
Bool
=
true
)
{
line
.
motionViewTransition
.
finish
(
isAnimated
:
isAnimated
)
}
/**
Cancels line transition.
- Parameter isAnimated: A Boolean indicating if the change should be animated.
*/
func
cancelLineTransition
(
isAnimated
:
Bool
=
true
)
{
line
.
motionViewTransition
.
cancel
(
isAnimated
:
isAnimated
)
}
}
fileprivate
extension
TabBar
{
/**
Removes the tabItem animation handler.
...
...
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