Space out the toolbar items on iOS 17/18. Give the article extractor button a stable width, so it doesn’t change widths when the progress indicator is showing.

This commit is contained in:
Brent Simmons committed 2026-04-02 10:33:14 -07:00
1 parent 1b59651e8a
commit c12970dfc4
2 files changed
+19 -1

No files matched your search

+1
View File
@@ -80,6 +80,7 @@ final class ArticleExtractorButton: UIButton {
private func commonInit() {
addSubview(activityIndicator)
NSLayoutConstraint.activate([
widthAnchor.constraint(equalToConstant: 44.0),
activityIndicator.centerXAnchor.constraint(equalTo: centerXAnchor),
activityIndicator.centerYAnchor.constraint(equalTo: centerYAnchor)
])
+18 -1
View File
@@ -117,7 +117,24 @@ final class ArticleViewController: UIViewController {
navigationItem.titleView = fullScreenTapZone
articleExtractorButton.addTarget(self, action: #selector(toggleArticleExtractor(_:)), for: .touchUpInside)
toolbarItems?.insert(UIBarButtonItem(customView: articleExtractorButton), at: 5)
let articleExtractorBarButtonItem = UIBarButtonItem(customView: articleExtractorButton)
if #available(iOS 26, *) {
toolbarItems?.insert(articleExtractorBarButtonItem, at: 5)
} else {
let flex = { UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil) }
toolbarItems = [
readBarButtonItem,
flex(),
starBarButtonItem,
flex(),
nextUnreadBarButtonItem,
flex(),
articleExtractorBarButtonItem,
flex(),
actionBarButtonItem
]
}
pageViewController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: [:])
pageViewController.delegate = self