better, muchbetter.
This commit is contained in:
parent
134ba463b9
commit
3d98c91e73
@ -191,7 +191,8 @@ import UIKit
|
|||||||
|
|
||||||
fieldContainer.layer.addSublayer(bottomBar)
|
fieldContainer.layer.addSublayer(bottomBar)
|
||||||
|
|
||||||
setNeedsLayout()
|
setNeedsDisplay()
|
||||||
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -219,9 +220,7 @@ import UIKit
|
|||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
super.layoutSubviews()
|
super.layoutSubviews()
|
||||||
|
|
||||||
if let fieldHeight = fieldContainer?.bounds.height {
|
resizeBottomBar(size: 1)
|
||||||
bottomBar.frame = CGRect(x: 0, y: fieldHeight, width: fieldHeight, height: 1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -247,18 +246,25 @@ import UIKit
|
|||||||
borderStrokeColor.setStroke()
|
borderStrokeColor.setStroke()
|
||||||
borderPath.stroke()
|
borderPath.stroke()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
func resizeBottomBar(from: CGFloat, to: CGFloat, duration: CFTimeInterval) {
|
func resizeBottomBar(size: CGFloat) {
|
||||||
|
|
||||||
|
// if bottomBar.frame.height == 1 {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
// let bottomBarHeight = CABasicAnimation(keyPath: "bounds.size.height")
|
||||||
|
// bottomBarHeight.fromValue = 1
|
||||||
|
// bottomBarHeight.toValue = 4
|
||||||
|
// bottomBarHeight.duration = 0.1
|
||||||
|
// bottomBarHeight.isRemovedOnCompletion = false
|
||||||
|
// bottomBar.add(bottomBarHeight, forKey: "bottomBarHeight")
|
||||||
|
|
||||||
let bottomBarHeight = CABasicAnimation(keyPath: "bounds.size.height")
|
|
||||||
bottomBarHeight.fromValue = from
|
|
||||||
bottomBarHeight.toValue = to
|
|
||||||
bottomBarHeight.duration = 0.1
|
|
||||||
bottomBarHeight.isRemovedOnCompletion = false
|
|
||||||
bottomBar.add(bottomBarHeight, forKey: "bottomBarHeight")
|
|
||||||
if let fieldBounds = fieldContainer?.bounds {
|
if let fieldBounds = fieldContainer?.bounds {
|
||||||
bottomBar.frame = CGRect(x: 0, y: fieldBounds.height, width: fieldBounds.width, height: to)
|
bottomBar.frame = CGRect(x: 0, y: fieldBounds.height - size, width: fieldBounds.width, height: size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,6 +308,8 @@ import UIKit
|
|||||||
bottomBar.backgroundColor = UIColor.black.cgColor
|
bottomBar.backgroundColor = UIColor.black.cgColor
|
||||||
descriptionLabel?.textColor = .mfBattleshipGrey()
|
descriptionLabel?.textColor = .mfBattleshipGrey()
|
||||||
|
|
||||||
|
resizeBottomBar(size: 1)
|
||||||
|
|
||||||
refreshUI()
|
refreshUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,7 +326,7 @@ import UIKit
|
|||||||
feedback = errorMessage
|
feedback = errorMessage
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeBottomBar(from: 1, to: 4, duration: 5)
|
resizeBottomBar(size: 4)
|
||||||
|
|
||||||
refreshUI()
|
refreshUI()
|
||||||
}
|
}
|
||||||
@ -330,6 +338,8 @@ import UIKit
|
|||||||
hideBorder = true
|
hideBorder = true
|
||||||
bottomBar.backgroundColor = UIColor.clear.cgColor
|
bottomBar.backgroundColor = UIColor.clear.cgColor
|
||||||
|
|
||||||
|
resizeBottomBar(size: 1)
|
||||||
|
|
||||||
refreshUI()
|
refreshUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,6 +351,8 @@ import UIKit
|
|||||||
borderStrokeColor = .black
|
borderStrokeColor = .black
|
||||||
bottomBar.backgroundColor = UIColor.black.cgColor
|
bottomBar.backgroundColor = UIColor.black.cgColor
|
||||||
|
|
||||||
|
resizeBottomBar(size: 1)
|
||||||
|
|
||||||
refreshUI()
|
refreshUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,6 +365,8 @@ import UIKit
|
|||||||
descriptionLabel?.textColor = self.isEnabled ? UIColor.mfBattleshipGrey() : UIColor.mfSilver()
|
descriptionLabel?.textColor = self.isEnabled ? UIColor.mfBattleshipGrey() : UIColor.mfSilver()
|
||||||
bottomBar.backgroundColor = self.isEnabled ? (self.showErrorMessage ? UIColor.mfPumpkin().cgColor : UIColor.black.cgColor) : UIColor.mfSilver().cgColor
|
bottomBar.backgroundColor = self.isEnabled ? (self.showErrorMessage ? UIColor.mfPumpkin().cgColor : UIColor.black.cgColor) : UIColor.mfSilver().cgColor
|
||||||
|
|
||||||
|
resizeBottomBar(size: 1)
|
||||||
|
|
||||||
refreshUI()
|
refreshUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user