mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-12-03 02:42:54 +00:00
Drop the empty navigation bar over articles when the bars move to a side
The article puts an empty view in the navigation bar's title so a tap on the bar can enter full screen. With the iOS 27.1 vertical bar (the iPhone Duo's outer screen, and the inner one in landscape) the bar buttons move to a side edge, and that title view is all that's left in the top bar. It keeps an empty bar across the top of the article. Leave the title view out while verticalBarEdge is set, and update it when the trait changes. Tapping the bar to enter full screen isn't available in that layout, which only matters with the full-screen setting on. The new API is behind #if compiler(>=6.4.2), the Swift in Xcode 27.2, so Xcodes whose SDKs don't have it still build. Verified in the iOS 27.2 iPhone Duo simulator: the outer screen in both orientations and the inner one in landscape. Inner portrait keeps its horizontal bar and the tap zone. Fixes #5530. Written with help from Claude Code.
This commit is contained in:
1 parent
70c5dce656
commit
4a035abd92
1 file changed
+23
-2
@@ -52,6 +52,8 @@ final class ArticleViewController: UIViewController {
|
||||
return button
|
||||
}()
|
||||
|
||||
private let fullScreenTapZone = UIView()
|
||||
|
||||
weak var coordinator: SceneCoordinator!
|
||||
|
||||
private let poppableDelegate = PoppableGestureRecognizerDelegate()
|
||||
@@ -132,13 +134,19 @@ final class ArticleViewController: UIViewController {
|
||||
navigationItem.scrollEdgeAppearance = appearance
|
||||
navigationItem.compactAppearance = appearance
|
||||
|
||||
let fullScreenTapZone = UIView()
|
||||
NSLayoutConstraint.activate([
|
||||
fullScreenTapZone.widthAnchor.constraint(equalToConstant: 150),
|
||||
fullScreenTapZone.heightAnchor.constraint(equalToConstant: 44)
|
||||
])
|
||||
fullScreenTapZone.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(didTapNavigationBar)))
|
||||
navigationItem.titleView = fullScreenTapZone
|
||||
updateFullScreenTapZone()
|
||||
#if compiler(>=6.4.2)
|
||||
if #available(iOS 27.1, *) {
|
||||
registerForTraitChanges(UITraitCollection.systemTraitsAffectingVerticalBarEdge) { (self: Self, _) in
|
||||
self.updateFullScreenTapZone()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
articleExtractorButton.addTarget(self, action: #selector(toggleArticleExtractor(_:)), for: .touchUpInside)
|
||||
let articleExtractorBarButtonItem = UIBarButtonItem(customView: articleExtractorButton)
|
||||
@@ -336,6 +344,19 @@ final class ArticleViewController: UIViewController {
|
||||
|
||||
// MARK: Actions
|
||||
|
||||
/// The tap zone lives in the navigation bar’s title view. When the system shows a vertical bar
|
||||
/// (iPhone Duo), the bar buttons move into it and the tap zone would be the only thing keeping
|
||||
/// an empty navigation bar across the top of the article, so it is left out.
|
||||
private func updateFullScreenTapZone() {
|
||||
#if compiler(>=6.4.2)
|
||||
if #available(iOS 27.1, *), traitCollection.verticalBarEdge != .unspecified {
|
||||
navigationItem.titleView = nil
|
||||
return
|
||||
}
|
||||
#endif
|
||||
navigationItem.titleView = fullScreenTapZone
|
||||
}
|
||||
|
||||
@objc func didTapNavigationBar() {
|
||||
currentWebViewController?.hideBars()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user