Force the progress view label to update with content size changes. Issue #1645

This commit is contained in:
Maurice Parker 2020-01-17 14:33:06 -07:00
parent a4896958c3
commit 2e583ae7b2
1 changed files with 8 additions and 1 deletions

View File

@ -17,6 +17,7 @@ class RefreshProgressView: UIView {
override func awakeFromNib() {
NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil)
if !AccountManager.shared.combinedRefreshProgress.isComplete {
progressChanged()
@ -53,6 +54,12 @@ class RefreshProgressView: UIView {
progressChanged()
}
@objc func contentSizeCategoryDidChange(_ note: Notification) {
// This hack is probably necessary because custom views in the toolbar don't get
// notifications that the content size changed.
label.font = UIFont.preferredFont(forTextStyle: .footnote)
}
deinit {
NotificationCenter.default.removeObserver(self)
}