Created
September 11, 2018 07:45
-
-
Save ShoMasegi/82221c50ed4abb15dd662d4cd0bdfb8f to your computer and use it in GitHub Desktop.
hatena_WithoutStoryboard_viewcontroller_llayout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SplashViewController: UIViewController { | |
... | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view.backgroundColor = .white | |
setupSubviews() | |
} | |
private lazy var label: UILabel = { | |
let label = UILabel() | |
label.font = UIFont(name: "Menlo", size: 30) | |
label.text = "Tutorial" | |
label.textAlignment = .center | |
return label | |
}() | |
private lazy var activityIndicator: UIActivityIndicatorView = { | |
let indicator = UIActivityIndicatorView(activityIndicatorStyle: .gray) | |
indicator.backgroundColor = .clear | |
return indicator | |
}() | |
private func setupSubviews() { | |
[label, activityIndicator].forEach(view.addSubview) | |
label.snp.makeConstraints { | |
$0.center.equalToSuperview() | |
} | |
activityIndicator.snp.makeConstraints { | |
$0.top.equalTo(logoView.snp.bottom).offset(60) | |
$0.centerX.equalToSuperview() | |
$0.height.width.equalTo(44) | |
} | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment