Skip to content

Instantly share code, notes, and snippets.

@malcolmkmd
Created September 15, 2017 12:20
Show Gist options
  • Save malcolmkmd/2bfea17153c5f6fadecd81a6d19189d5 to your computer and use it in GitHub Desktop.
Save malcolmkmd/2bfea17153c5f6fadecd81a6d19189d5 to your computer and use it in GitHub Desktop.
SetupView for LockScreenX
func setupView(){
// Background View
view.addSubview(bgImageView)
bgImageView.snp.makeConstraints{ make in
make.edges.equalToSuperview()
}
// Detail Container View
view.addSubview(detailContainer)
detailContainer.snp.makeConstraints{ make in
make.width.equalToSuperview()
make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom)
make.height.equalTo(180)
}
detailContainer.addSubview(arrowBtn)
arrowBtn.snp.makeConstraints{ make in
make.right.equalToSuperview().inset(Theme.inset.double)
make.width.equalTo(50)
make.height.equalTo(35)
make.bottom.equalToSuperview().inset(Theme.inset.double)
}
detailContainer.addSubview(eventDescriptionLabel)
eventDescriptionLabel.snp.makeConstraints{ make in
make.left.equalToSuperview().inset(Theme.inset.triple)
make.bottom.equalToSuperview().inset(Theme.inset.double)
make.right.equalTo(arrowBtn.snp.left)
make.height.equalTo(45)
}
detailContainer.addSubview(eventTitle)
eventTitle.snp.makeConstraints{ make in
make.left.width.equalTo(eventDescriptionLabel)
make.height.equalTo(80)
make.bottom.equalTo(eventDescriptionLabel.snp.top)
}
detailContainer.addSubview(eventDateLabel)
eventDateLabel.snp.makeConstraints{ make in
make.left.equalTo(eventTitle)
make.height.equalTo(20)
make.right.equalToSuperview()
make.bottom.equalTo(eventTitle.snp.top)
}
view.addSubview(timeLabel)
timeLabel.snp.makeConstraints{ make in
make.top.equalTo(view.safeAreaLayoutGuide.snp.top).inset(Theme.inset.triple)
make.left.equalToSuperview().inset(Theme.inset.double)
make.width.lessThanOrEqualToSuperview().multipliedBy(0.5)
make.height.equalTo(80)
}
view.addSubview(dateLabel)
dateLabel.snp.makeConstraints{ make in
make.top.equalTo(timeLabel.snp.bottom).inset(Theme.inset.single)
make.left.equalTo(timeLabel).inset(Theme.inset.single)
make.width.equalToSuperview().multipliedBy(0.5)
make.height.equalTo(40)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment