Files
Attractor/App/Document Controls UI/FontSizeAdjustView.swift

61 lines
1.6 KiB
Swift
Raw Normal View History

2020-09-22 15:37:13 -07:00
//
// FontSizeAdjustView.swift
// App
//
// Created by James Magahern on 9/22/20.
//
import UIKit
class FontSizeAdjustView: DocumentControlItemView
2020-09-22 15:37:13 -07:00
{
let decreaseSizeButton = UIButton(frame: .zero)
let increaseSizeButton = UIButton(frame: .zero)
let labelView = UILabel(frame: .zero)
2020-09-30 18:06:47 -07:00
override init() {
super.init()
2020-09-22 15:37:13 -07:00
labelView.textColor = .secondaryLabel
labelView.textAlignment = .center
labelView.text = "100%"
tintColor = .label
2020-09-22 15:37:13 -07:00
decreaseSizeButton.setImage(UIImage(systemName: "minus"), for: .normal)
increaseSizeButton.setImage(UIImage(systemName: "plus"), for: .normal)
addSubview(increaseSizeButton)
addSubview(decreaseSizeButton)
addSubview(labelView)
}
2020-09-30 18:06:47 -07:00
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
2020-09-22 15:37:13 -07:00
}
override func layoutSubviews() {
super.layoutSubviews()
2020-09-30 18:06:47 -07:00
highlightView.isHidden = true
2020-09-22 15:37:13 -07:00
decreaseSizeButton.frame = CGRect(
x: 0.0, y: 0.0,
width: bounds.height,
height: bounds.height
)
increaseSizeButton.frame = CGRect(
x: bounds.width - bounds.height, y: 0.0,
width: bounds.height,
height: bounds.height
)
labelView.frame = CGRect(
x: decreaseSizeButton.frame.maxX, y: 0.0,
width: bounds.width - decreaseSizeButton.frame.width - increaseSizeButton.frame.width,
height: bounds.height
)
}
}