Hide timeline First Unread button when detail view displayed.
This commit is contained in:
parent
0bfd19ab30
commit
b2e080cf8e
|
@ -153,6 +153,9 @@
|
|||
</toolbarItems>
|
||||
<navigationItem key="navigationItem" title="Timeline" largeTitleDisplayMode="never" id="wcC-1L-ug4"/>
|
||||
<simulatedToolbarMetrics key="simulatedBottomBarMetrics"/>
|
||||
<connections>
|
||||
<outlet property="nextUnreadButton" destination="2v2-jD-C9k" id="9rf-5I-18f"/>
|
||||
</connections>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="nzm-Gf-Xce" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
|
|
|
@ -20,17 +20,11 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||
return navState?.showFeedNames ?? false ? rowHeightWithFeedName : rowHeightWithoutFeedName
|
||||
}
|
||||
|
||||
@IBOutlet weak var nextUnreadButton: UIBarButtonItem!
|
||||
|
||||
weak var navState: NavigationStateController?
|
||||
var undoableCommands = [UndoableCommand]()
|
||||
|
||||
var detailViewController: DetailViewController? {
|
||||
if let split = splitViewController {
|
||||
let controllers = split.viewControllers
|
||||
return (controllers[controllers.count-1] as! UINavigationController).topViewController as? DetailViewController
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
override var canBecomeFirstResponder: Bool {
|
||||
return true
|
||||
}
|
||||
|
@ -56,6 +50,8 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||
refreshControl = UIRefreshControl()
|
||||
refreshControl!.addTarget(self, action: #selector(refreshAccounts(_:)), for: .valueChanged)
|
||||
|
||||
splitViewController?.delegate = self
|
||||
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
|
@ -339,6 +335,20 @@ class MasterTimelineViewController: UITableViewController, UndoableCommandRunner
|
|||
|
||||
}
|
||||
|
||||
extension MasterTimelineViewController: UISplitViewControllerDelegate {
|
||||
|
||||
func splitViewController(_ svc: UISplitViewController, willChangeTo displayMode: UISplitViewController.DisplayMode) {
|
||||
if displayMode == .allVisible {
|
||||
nextUnreadButton.isEnabled = false
|
||||
nextUnreadButton.title = ""
|
||||
} else {
|
||||
nextUnreadButton.isEnabled = false
|
||||
nextUnreadButton.title = NSLocalizedString("First Unread", comment: "First Unread")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private extension MasterTimelineViewController {
|
||||
|
|
Loading…
Reference in New Issue