blockchainethereumblockchain-walleterc20erc721walletxdaidappdecentralizederc1155erc875iosswifttokens
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
2.3 KiB
62 lines
2.3 KiB
7 years ago
|
// Copyright SIX DAY LLC. All rights reserved.
|
||
|
import UIKit
|
||
|
|
||
|
enum WellDoneAction {
|
||
|
case other
|
||
|
}
|
||
|
|
||
|
protocol WellDoneViewControllerDelegate: class {
|
||
|
func didPress(action: WellDoneAction, sender: UIView, in viewController: WellDoneViewController)
|
||
|
}
|
||
|
|
||
|
class WellDoneViewController: UIViewController {
|
||
|
weak var delegate: WellDoneViewControllerDelegate?
|
||
|
|
||
|
override func viewDidLoad() {
|
||
|
super.viewDidLoad()
|
||
|
|
||
|
let imageView = UIImageView(image: R.image.mascot_happy())
|
||
|
imageView.translatesAutoresizingMaskIntoConstraints = false
|
||
|
|
||
|
let descriptionLabel = UILabel()
|
||
|
descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
|
||
7 years ago
|
descriptionLabel.text = R.string.localizable.welldoneDescriptionLabelText()
|
||
7 years ago
|
descriptionLabel.font = Fonts.regular(size: Fonts.labelSize)
|
||
7 years ago
|
descriptionLabel.textColor = Colors.darkBlue
|
||
7 years ago
|
descriptionLabel.numberOfLines = 0
|
||
|
descriptionLabel.textAlignment = .center
|
||
|
|
||
|
let otherButton = Button(size: .normal, style: .solid)
|
||
|
otherButton.translatesAutoresizingMaskIntoConstraints = false
|
||
7 years ago
|
otherButton.setTitle(R.string.localizable.welldoneShareLabelText(), for: .normal)
|
||
7 years ago
|
otherButton.addTarget(self, action: #selector(other(_:)), for: .touchUpInside)
|
||
|
|
||
7 years ago
|
let stackView = [
|
||
7 years ago
|
imageView,
|
||
|
//titleLabel,
|
||
|
descriptionLabel,
|
||
|
.spacer(height: 10),
|
||
|
.spacer(),
|
||
|
otherButton,
|
||
7 years ago
|
].asStackView(axis: .vertical, spacing: 10, alignment: .center)
|
||
7 years ago
|
stackView.translatesAutoresizingMaskIntoConstraints = false
|
||
|
|
||
|
view.backgroundColor = .white
|
||
|
view.addSubview(stackView)
|
||
|
|
||
|
NSLayoutConstraint.activate([
|
||
|
stackView.topAnchor.constraint(greaterThanOrEqualTo: view.topAnchor),
|
||
|
stackView.leadingAnchor.constraint(equalTo: view.readableContentGuide.leadingAnchor),
|
||
|
stackView.trailingAnchor.constraint(equalTo: view.readableContentGuide.trailingAnchor),
|
||
|
stackView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
|
||
|
stackView.bottomAnchor.constraint(lessThanOrEqualTo: view.bottomAnchor),
|
||
|
|
||
|
otherButton.widthAnchor.constraint(equalToConstant: 240),
|
||
|
])
|
||
|
}
|
||
|
|
||
|
@objc private func other(_ sender: UIView) {
|
||
|
delegate?.didPress(action: .other, sender: sender, in: self)
|
||
|
}
|
||
|
}
|