|
import UIKit |
|
|
|
fileprivate let buttonSize: CGFloat = 56 |
|
fileprivate let shadowOpacity: Float = 0.7 |
|
|
|
class ButtonPanelView: UIView { |
|
|
|
lazy var menuButton: UIButton = { |
|
let button = UIButton(frame: .zero) |
|
button.setTitle("➕", for: .normal) |
|
button.backgroundColor = .clear |
|
button.layer.cornerRadius = buttonSize / 2 |
|
button.addTarget( |
|
self, action: #selector(handleTogglePanelButtonTapped(_:)), for: .touchUpInside) |
|
return button |
|
}() |
|
|
|
lazy var dogButton: UIButton = { |
|
let button = UIButton(frame: .zero) |
|
button.setTitle("🐶", for: .normal) |
|
button.layer.cornerRadius = buttonSize / 2 |
|
button.isHidden = true |
|
return button |
|
}() |
|
|
|
lazy var catButton: UIButton = { |
|
let button = UIButton(frame: .zero) |
|
button.setTitle("🐱", for: .normal) |
|
button.layer.cornerRadius = buttonSize / 2 |
|
button.isHidden = true |
|
return button |
|
}() |
|
|
|
lazy var expandedStackView: UIStackView = { |
|
let stackView = UIStackView() |
|
stackView.axis = .vertical |
|
stackView.isHidden = true |
|
stackView.addArrangedSubview(dogButton) |
|
stackView.addArrangedSubview(catButton) |
|
return stackView |
|
}() |
|
|
|
lazy var containerStackView: UIStackView = { |
|
let stackView = UIStackView() |
|
stackView.axis = .vertical |
|
stackView.addArrangedSubview(expandedStackView) |
|
stackView.addArrangedSubview(menuButton) |
|
return stackView |
|
}() |
|
|
|
// ... |
|
} |