Adds back/forward buttons to page menu
This commit is contained in:
@@ -31,8 +31,8 @@ class DocumentControlView: UIControl
|
||||
|
||||
tintColor = .label
|
||||
|
||||
label.font = UIFont.preferredFont(forTextStyle: .subheadline)
|
||||
label.textAlignment = .center
|
||||
label.font = UIFont.preferredFont(forTextStyle: .body)
|
||||
label.textAlignment = .left
|
||||
|
||||
imageView.contentMode = .center
|
||||
|
||||
|
||||
@@ -9,9 +9,12 @@ import UIKit
|
||||
|
||||
class DocumentControlViewController: UIViewController
|
||||
{
|
||||
let documentControlView = StackView(dimension: .vertical)
|
||||
let documentControlView = StackView<DocumentControlView>(dimension: .vertical)
|
||||
let fontSizeAdjustView = FontSizeAdjustView()
|
||||
let findOnPageControlView = DocumentControlView()
|
||||
let navigationControlView = NavigationControlsView()
|
||||
|
||||
var observations: [NSKeyValueObservation] = []
|
||||
|
||||
static public let preferredWidth = CGFloat(200.0)
|
||||
|
||||
@@ -21,10 +24,13 @@ class DocumentControlViewController: UIViewController
|
||||
findOnPageControlView.label.text = "Find On Page"
|
||||
findOnPageControlView.imageView.image = UIImage(systemName: "magnifyingglass")
|
||||
|
||||
fontSizeAdjustView.drawsBottomSeparator = true
|
||||
|
||||
documentControlView.addArrangedSubview(navigationControlView)
|
||||
documentControlView.addArrangedSubview(fontSizeAdjustView)
|
||||
documentControlView.addArrangedSubview(findOnPageControlView)
|
||||
|
||||
for (i, view) in documentControlView.arrangedSubviews.enumerated() {
|
||||
view.drawsBottomSeparator = (i < documentControlView.arrangedSubviews.count - 1)
|
||||
}
|
||||
}
|
||||
|
||||
override func loadView() {
|
||||
|
||||
37
App/Document Controls UI/NavigationControlsView.swift
Normal file
37
App/Document Controls UI/NavigationControlsView.swift
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// NavigationControlsView.swift
|
||||
// App
|
||||
//
|
||||
// Created by James Magahern on 2/11/21.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class NavigationControlsView: DocumentControlView
|
||||
{
|
||||
let backButton = UIButton(frame: .zero)
|
||||
let forwardButton = UIButton(frame: .zero)
|
||||
|
||||
let stack = StackView(dimension: .horizontal, layoutType: .equalSize)
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
backButton.setImage(UIImage(systemName: "chevron.left"), for: .normal)
|
||||
stack.addArrangedSubview(backButton)
|
||||
|
||||
forwardButton.setImage(UIImage(systemName: "chevron.right"), for: .normal)
|
||||
stack.addArrangedSubview(forwardButton)
|
||||
|
||||
addSubview(stack)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
stack.frame = bounds
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user