Commit c8369cae by Daniel Dahan

issue-833: fixed regression

parent 360d7223
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Material' s.name = 'Material'
s.version = '2.9.1' s.version = '2.9.2'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'
s.summary = 'A Material Design library for creating beautiful applications.' s.summary = 'A Material Design library for creating beautiful applications.'
s.homepage = 'http://materialswift.com' s.homepage = 'http://materialswift.com'
......
...@@ -72,6 +72,9 @@ public enum TabBarStyle: Int { ...@@ -72,6 +72,9 @@ public enum TabBarStyle: Int {
} }
open class TabBar: Bar { open class TabBar: Bar {
/// Only for inital load to get the line animation correct.
fileprivate var shouldNotAnimateLineView = false
/// The total width of the tabItems. /// The total width of the tabItems.
fileprivate var tabItemsTotalWidth: CGFloat { fileprivate var tabItemsTotalWidth: CGFloat {
var w: CGFloat = 0 var w: CGFloat = 0
...@@ -241,6 +244,8 @@ fileprivate extension TabBar { ...@@ -241,6 +244,8 @@ fileprivate extension TabBar {
/// Prepares the tabItems. /// Prepares the tabItems.
func prepareTabItems() { func prepareTabItems() {
shouldNotAnimateLineView = true
for v in tabItems { for v in tabItems {
v.grid.columns = 0 v.grid.columns = 0
v.contentEdgeInsets = .zero v.contentEdgeInsets = .zero
...@@ -318,11 +323,16 @@ fileprivate extension TabBar { ...@@ -318,11 +323,16 @@ fileprivate extension TabBar {
return return
} }
line.animate(.duration(0), guard shouldNotAnimateLineView else {
.size(CGSize(width: v.width, height: lineHeight)), line.animate(.duration(0),
.position(CGPoint(x: v.x + v.width / 2, y: .bottom == lineAlignment ? height - lineHeight / 2 : lineHeight / 2))) .size(CGSize(width: v.width, height: lineHeight)),
.position(CGPoint(x: v.center.x, y: .bottom == lineAlignment ? height - lineHeight / 2 : lineHeight / 2)))
return
}
line.frame = CGRect(x: v.x, y: .bottom == lineAlignment ? scrollView.height - lineHeight : 0, width: v.width, height: lineHeight)
// line.frame = CGRect(x: v.x, y: .bottom == lineAlignment ? scrollView.height - lineHeight : 0, width: v.width, height: lineHeight) shouldNotAnimateLineView = false
} }
} }
...@@ -382,9 +392,10 @@ fileprivate extension TabBar { ...@@ -382,9 +392,10 @@ fileprivate extension TabBar {
} }
selectedTabItem = tabItem selectedTabItem = tabItem
line.animate(.duration(0.25), line.animate(.duration(0.25),
.size(CGSize(width: tabItem.width, height: lineHeight)), .size(CGSize(width: tabItem.width, height: lineHeight)),
.position(CGPoint(x: tabItem.x + tabItem.width / 2, y: .bottom == lineAlignment ? height - lineHeight / 2 : lineHeight / 2)), .position(CGPoint(x: tabItem.center.x, y: .bottom == lineAlignment ? height - lineHeight / 2 : lineHeight / 2)),
.completion { [weak self, isTriggeredByUserInteraction = isTriggeredByUserInteraction, tabItem = tabItem, completion = completion] _ in .completion { [weak self, isTriggeredByUserInteraction = isTriggeredByUserInteraction, tabItem = tabItem, completion = completion] _ in
guard let s = self else { guard let s = self else {
return return
......
...@@ -128,7 +128,7 @@ open class TransitionController: UIViewController { ...@@ -128,7 +128,7 @@ open class TransitionController: UIViewController {
super.viewWillLayoutSubviews() super.viewWillLayoutSubviews()
layoutSubviews() layoutSubviews()
} }
/** /**
A method to swap rootViewController objects. A method to swap rootViewController objects.
- Parameter toViewController: The UIViewController to swap - Parameter toViewController: The UIViewController to swap
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment