Put document controls view in a scroll view
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class DocumentControlView: UIControl
|
||||
class DocumentControlItemView: UIControl
|
||||
{
|
||||
static public let controlHeight = CGFloat(48.0)
|
||||
|
||||
@@ -9,14 +9,14 @@ import UIKit
|
||||
|
||||
class DocumentControlViewController: UIViewController
|
||||
{
|
||||
let documentControlView = StackView<DocumentControlView>(dimension: .vertical)
|
||||
let documentControlsView = DocumentControlsView()
|
||||
let fontSizeAdjustView = FontSizeAdjustView()
|
||||
let findOnPageControlView = DocumentControlView()
|
||||
let findOnPageControlView = DocumentControlItemView()
|
||||
let navigationControlView = NavigationControlsView()
|
||||
let settingsView = DocumentControlView()
|
||||
let readabilityView = DocumentControlView()
|
||||
let darkModeView = DocumentControlView()
|
||||
let archiveView = DocumentControlView()
|
||||
let settingsView = DocumentControlItemView()
|
||||
let readabilityView = DocumentControlItemView()
|
||||
let darkModeView = DocumentControlItemView()
|
||||
let archiveView = DocumentControlItemView()
|
||||
|
||||
var observations: [NSKeyValueObservation] = []
|
||||
|
||||
@@ -45,17 +45,17 @@ class DocumentControlViewController: UIViewController
|
||||
|
||||
darkModeView.imageView.image = DarkModeControls.buttonImage(forDarkModeState: darkModeEnabled)
|
||||
|
||||
documentControlView.addArrangedSubview(navigationControlView)
|
||||
documentControlView.addArrangedSubview(fontSizeAdjustView)
|
||||
documentControlView.addArrangedSubview(findOnPageControlView)
|
||||
documentControlView.addArrangedSubview(darkModeView)
|
||||
documentControlView.addArrangedSubview(readabilityView)
|
||||
documentControlView.addArrangedSubview(archiveView)
|
||||
documentControlsView.stackView.addArrangedSubview(navigationControlView)
|
||||
documentControlsView.stackView.addArrangedSubview(fontSizeAdjustView)
|
||||
documentControlsView.stackView.addArrangedSubview(findOnPageControlView)
|
||||
documentControlsView.stackView.addArrangedSubview(darkModeView)
|
||||
documentControlsView.stackView.addArrangedSubview(readabilityView)
|
||||
documentControlsView.stackView.addArrangedSubview(archiveView)
|
||||
|
||||
documentControlView.addArrangedSubview(settingsView)
|
||||
documentControlsView.stackView.addArrangedSubview(settingsView)
|
||||
|
||||
for (i, view) in documentControlView.arrangedSubviews.enumerated() {
|
||||
view.drawsBottomSeparator = (i < documentControlView.arrangedSubviews.count - 1)
|
||||
for (i, view) in documentControlsView.stackView.arrangedSubviews.enumerated() {
|
||||
view.drawsBottomSeparator = (i < documentControlsView.stackView.arrangedSubviews.count - 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,11 +64,11 @@ class DocumentControlViewController: UIViewController
|
||||
}
|
||||
|
||||
override func loadView() {
|
||||
self.view = documentControlView
|
||||
self.view = documentControlsView
|
||||
}
|
||||
|
||||
override var preferredContentSize: CGSize {
|
||||
get { documentControlView.sizeThatFits(CGSize(width: Self.preferredWidth, height: -1)) }
|
||||
get { documentControlsView.stackView.sizeThatFits(CGSize(width: Self.preferredWidth, height: -1)) }
|
||||
set {}
|
||||
}
|
||||
}
|
||||
|
||||
29
App/Document Controls UI/DocumentControlsView.swift
Normal file
29
App/Document Controls UI/DocumentControlsView.swift
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// DocumentControlsView.swift
|
||||
// App
|
||||
//
|
||||
// Created by James Magahern on 4/28/21.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class DocumentControlsView : UIScrollView
|
||||
{
|
||||
public let stackView = StackView<DocumentControlItemView>(dimension: .vertical)
|
||||
|
||||
convenience init() {
|
||||
self.init(frame: .zero)
|
||||
addSubview(stackView)
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
let stackViewSize = stackView.sizeThatFits(CGSize(width: bounds.width, height: -1))
|
||||
stackView.frame = CGRect(
|
||||
origin: .zero, size: stackViewSize
|
||||
)
|
||||
|
||||
contentSize = stackViewSize
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class FontSizeAdjustView: DocumentControlView
|
||||
class FontSizeAdjustView: DocumentControlItemView
|
||||
{
|
||||
let decreaseSizeButton = UIButton(frame: .zero)
|
||||
let increaseSizeButton = UIButton(frame: .zero)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class NavigationControlsView: DocumentControlView
|
||||
class NavigationControlsView: DocumentControlItemView
|
||||
{
|
||||
let backButton = UIButton(frame: .zero)
|
||||
let forwardButton = UIButton(frame: .zero)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
1AD3103D252541E600A4A952 /* PersonalRedirectRules.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3103C252541E600A4A952 /* PersonalRedirectRules.swift */; };
|
||||
1AD31040252545BF00A4A952 /* FindOnPageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3103F252545BF00A4A952 /* FindOnPageView.swift */; };
|
||||
1AD3104325254FB900A4A952 /* FindOnPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD3104225254FB900A4A952 /* FindOnPageViewController.swift */; };
|
||||
1AD310452525586B00A4A952 /* DocumentControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD310442525586B00A4A952 /* DocumentControlView.swift */; };
|
||||
1AD310452525586B00A4A952 /* DocumentControlItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1AD310442525586B00A4A952 /* DocumentControlItemView.swift */; };
|
||||
1ADFF46024C7DE53006DC7AE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */; };
|
||||
1ADFF46224C7DE53006DC7AE /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1ADFF46124C7DE53006DC7AE /* SceneDelegate.swift */; };
|
||||
1ADFF46924C7DE54006DC7AE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1ADFF46824C7DE54006DC7AE /* Assets.xcassets */; };
|
||||
@@ -51,6 +51,7 @@
|
||||
CD853BD124E778B800D2BDCC /* History.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = CD853BCF24E778B800D2BDCC /* History.xcdatamodeld */; };
|
||||
CD853BD424E77BF900D2BDCC /* HistoryItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD853BD324E77BF900D2BDCC /* HistoryItem.swift */; };
|
||||
CD97CF9225D5BE6F00288FEE /* NavigationControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD97CF9125D5BE6F00288FEE /* NavigationControlsView.swift */; };
|
||||
CDAD9CE8263A2DF200FF7199 /* DocumentControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDAD9CE7263A2DF200FF7199 /* DocumentControlsView.swift */; };
|
||||
CDC4A1CF25E9D8F7007D33C6 /* Tagger.js in Resources */ = {isa = PBXBuildFile; fileRef = CDC4A1CE25E9D8F7007D33C6 /* Tagger.js */; };
|
||||
CDC5DA3A25DB774D00BA8D99 /* Readability.js in Resources */ = {isa = PBXBuildFile; fileRef = CDC5DA3925DB774D00BA8D99 /* Readability.js */; };
|
||||
CDC5DA3E25DB7C2C00BA8D99 /* ReaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDC5DA3D25DB7C2C00BA8D99 /* ReaderViewController.swift */; };
|
||||
@@ -104,7 +105,7 @@
|
||||
1AD3103C252541E600A4A952 /* PersonalRedirectRules.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PersonalRedirectRules.swift; sourceTree = "<group>"; };
|
||||
1AD3103F252545BF00A4A952 /* FindOnPageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindOnPageView.swift; sourceTree = "<group>"; };
|
||||
1AD3104225254FB900A4A952 /* FindOnPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindOnPageViewController.swift; sourceTree = "<group>"; };
|
||||
1AD310442525586B00A4A952 /* DocumentControlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentControlView.swift; sourceTree = "<group>"; };
|
||||
1AD310442525586B00A4A952 /* DocumentControlItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentControlItemView.swift; sourceTree = "<group>"; };
|
||||
1ADFF45C24C7DE53006DC7AE /* rossler\\attix.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "rossler\\\\attix.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1ADFF45F24C7DE53006DC7AE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
1ADFF46124C7DE53006DC7AE /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
|
||||
@@ -143,6 +144,7 @@
|
||||
CD853BD024E778B800D2BDCC /* History.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = History.xcdatamodel; sourceTree = "<group>"; };
|
||||
CD853BD324E77BF900D2BDCC /* HistoryItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HistoryItem.swift; sourceTree = "<group>"; };
|
||||
CD97CF9125D5BE6F00288FEE /* NavigationControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavigationControlsView.swift; sourceTree = "<group>"; };
|
||||
CDAD9CE7263A2DF200FF7199 /* DocumentControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DocumentControlsView.swift; sourceTree = "<group>"; };
|
||||
CDC4A1CE25E9D8F7007D33C6 /* Tagger.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = Tagger.js; sourceTree = "<group>"; };
|
||||
CDC5DA3925DB774D00BA8D99 /* Readability.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = Readability.js; sourceTree = "<group>"; };
|
||||
CDC5DA3D25DB7C2C00BA8D99 /* ReaderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReaderViewController.swift; sourceTree = "<group>"; };
|
||||
@@ -390,7 +392,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CDCE2663251AA80F007FE92A /* DocumentControlViewController.swift */,
|
||||
1AD310442525586B00A4A952 /* DocumentControlView.swift */,
|
||||
CDAD9CE7263A2DF200FF7199 /* DocumentControlsView.swift */,
|
||||
1AD310442525586B00A4A952 /* DocumentControlItemView.swift */,
|
||||
CDCE2667251AAA9A007FE92A /* FontSizeAdjustView.swift */,
|
||||
CD97CF9125D5BE6F00288FEE /* NavigationControlsView.swift */,
|
||||
);
|
||||
@@ -554,6 +557,7 @@
|
||||
CDE6A30625F023EA00E912A4 /* SettingsView.swift in Sources */,
|
||||
1AB88EFD24D3BA560006F850 /* TabController.swift in Sources */,
|
||||
1ADFF4C324CA6AF6006DC7AE /* Geometry.swift in Sources */,
|
||||
CDAD9CE8263A2DF200FF7199 /* DocumentControlsView.swift in Sources */,
|
||||
1ADFF4C924CA793E006DC7AE /* ToolbarViewController.swift in Sources */,
|
||||
CD7A89172519872D0075991E /* KeyboardShortcuts.swift in Sources */,
|
||||
1ADFF4CD24CBB0C8006DC7AE /* ScriptPolicyViewController.swift in Sources */,
|
||||
@@ -564,7 +568,7 @@
|
||||
CDCE2664251AA80F007FE92A /* DocumentControlViewController.swift in Sources */,
|
||||
1AB88EFF24D3BBA50006F850 /* TabPickerViewController.swift in Sources */,
|
||||
1A14FC2324D203D9009B3F83 /* TitlebarView.swift in Sources */,
|
||||
1AD310452525586B00A4A952 /* DocumentControlView.swift in Sources */,
|
||||
1AD310452525586B00A4A952 /* DocumentControlItemView.swift in Sources */,
|
||||
CD97CF9225D5BE6F00288FEE /* NavigationControlsView.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
||||
Reference in New Issue
Block a user