mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-22 23:58:36 +01:00
Fix disappearing reader view button
This commit is contained in:
parent
65356424d9
commit
da4715c6d1
@ -88,6 +88,7 @@ class ArticleViewController: UIViewController {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(progressDidChange(_:)), name: .AccountRefreshProgressDidChange, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(contentSizeCategoryDidChange(_:)), name: UIContentSizeCategory.didChangeNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(_:)), name: UIApplication.willEnterForegroundNotification, object: nil)
|
||||
|
||||
articleExtractorButton.addTarget(self, action: #selector(toggleArticleExtractor(_:)), for: .touchUpInside)
|
||||
navigationItem.titleView = articleExtractorButton
|
||||
@ -197,6 +198,20 @@ class ArticleViewController: UIViewController {
|
||||
reloadHTML()
|
||||
}
|
||||
|
||||
// Don't delete this even though it looks like it isn't doing anything. This is to work
|
||||
// around a bug (don't know if it is an Apple one or ours) that happens when the root
|
||||
// split view controller is not collapsed. When the app goes to the background and then
|
||||
// comes back to the foreground the article extractor button will disappear. The
|
||||
// navigationItem will still have a reference to the articleExtractorButton, but if you
|
||||
// check in the view debugger, the button isn't in the view hierarchy anymore.
|
||||
// Setting the titleView to nil and then back to the articleExtractorButton hides that
|
||||
// this happened. If we move the articleExtractorButton to someplace other than the
|
||||
// titleView, then this code can be safely deleted.
|
||||
@objc func willEnterForeground(_ note: Notification) {
|
||||
navigationItem.titleView = nil
|
||||
navigationItem.titleView = articleExtractorButton
|
||||
}
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
@IBAction func toggleArticleExtractor(_ sender: Any) {
|
||||
|
Loading…
Reference in New Issue
Block a user