Skip to content

Instantly share code, notes, and snippets.

@ShoMasegi
Created September 11, 2018 07:45
Show Gist options
  • Save ShoMasegi/82221c50ed4abb15dd662d4cd0bdfb8f to your computer and use it in GitHub Desktop.
Save ShoMasegi/82221c50ed4abb15dd662d4cd0bdfb8f to your computer and use it in GitHub Desktop.
hatena_WithoutStoryboard_viewcontroller_llayout
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