mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-08 16:18:48 +01:00
Don't animate the disclosure icon until it has been added to the view hierarchy. Issue #1717
This commit is contained in:
parent
6454330c8b
commit
13a1ef0605
@ -42,7 +42,6 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
|||||||
set {
|
set {
|
||||||
if titleView.text != newValue {
|
if titleView.text != newValue {
|
||||||
titleView.text = newValue
|
titleView.text = newValue
|
||||||
setNeedsDisplay()
|
|
||||||
setNeedsLayout()
|
setNeedsLayout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -50,7 +49,7 @@ class MasterFeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
|||||||
|
|
||||||
var disclosureExpanded = false {
|
var disclosureExpanded = false {
|
||||||
didSet {
|
didSet {
|
||||||
updateExpandedState()
|
updateExpandedState(animate: true)
|
||||||
updateUnreadCountView()
|
updateUnreadCountView()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,19 +115,22 @@ private extension MasterFeedTableViewSectionHeader {
|
|||||||
func commonInit() {
|
func commonInit() {
|
||||||
addSubviewAtInit(unreadCountView)
|
addSubviewAtInit(unreadCountView)
|
||||||
addSubviewAtInit(titleView)
|
addSubviewAtInit(titleView)
|
||||||
updateExpandedState()
|
|
||||||
addSubviewAtInit(disclosureView)
|
addSubviewAtInit(disclosureView)
|
||||||
|
updateExpandedState(animate: false)
|
||||||
addBackgroundView()
|
addBackgroundView()
|
||||||
addSubviewAtInit(topSeparatorView)
|
addSubviewAtInit(topSeparatorView)
|
||||||
addSubviewAtInit(bottomSeparatorView)
|
addSubviewAtInit(bottomSeparatorView)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateExpandedState() {
|
func updateExpandedState(animate: Bool) {
|
||||||
if !isLastSection && self.disclosureExpanded {
|
if !isLastSection && self.disclosureExpanded {
|
||||||
self.bottomSeparatorView.isHidden = false
|
self.bottomSeparatorView.isHidden = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let duration = animate ? 0.3 : 0.0
|
||||||
|
|
||||||
UIView.animate(
|
UIView.animate(
|
||||||
withDuration: 0.3,
|
withDuration: duration,
|
||||||
animations: {
|
animations: {
|
||||||
if self.disclosureExpanded {
|
if self.disclosureExpanded {
|
||||||
self.disclosureView.transform = CGAffineTransform(rotationAngle: 1.570796)
|
self.disclosureView.transform = CGAffineTransform(rotationAngle: 1.570796)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user