Skip to content

Instantly share code, notes, and snippets.

@sunnyleeyun
Created January 17, 2018 10:04
Show Gist options
  • Save sunnyleeyun/0f4e257a4761a09d4eff4247226d056d to your computer and use it in GitHub Desktop.
Save sunnyleeyun/0f4e257a4761a09d4eff4247226d056d to your computer and use it in GitHub Desktop.
// Temporary view
self.question_View.addSubview(temp_View)
temp_View.backgroundColor = UIColor.white
temp_View.snp.makeConstraints { (make) in
make.edges.equalTo(question_View)
}
// Topic Label
temp_View.addSubview(topic_Label)
topic_Label.text = question.title
topic_Label.numberOfLines = 2
topic_Label.font = topic_Label.font.withSize(24.0)
topic_Label.textAlignment = .left
topic_Label.snp.makeConstraints { (make) in
make.left.right.equalTo(temp_View).inset(10)
make.top.equalTo(temp_View.snp.top).offset(10)
}
// Answer Label
temp_View.addSubview(ans_Label)
ans_Label.font = ans_Label.font.withSize(20.0)
ans_Label.textAlignment = .center
ans_Label.snp.makeConstraints { (make) in
make.top.equalTo(topic_Label.snp.bottom).offset(10)
make.left.right.equalTo(temp_View).inset(10)
}
// left/right Label
let lft_Label = UILabel()
lft_Label.text = question.ltext
lft_Label.textAlignment = .left
temp_View.addSubview(lft_Label)
lft_Label.snp.makeConstraints { (make) in
make.top.equalTo(ans_Label.snp.bottom).offset(10)
make.left.equalTo(temp_View).inset(5)
}
let rht_Label = UILabel()
rht_Label.text = question.rtext
rht_Label.textAlignment = .right
temp_View.addSubview(rht_Label)
rht_Label.snp.makeConstraints { (make) in
make.top.equalTo(ans_Label.snp.bottom).offset(10)
make.right.equalTo(temp_View).inset(5)
}
// Slider
temp_View.addSubview(drag_Slider)
drag_Slider.snp.makeConstraints { (make) in
make.top.equalTo(ans_Label.snp.bottom).offset(10)
make.centerX.equalTo(temp_View)
make.right.equalTo(rht_Label.snp.left).inset(10)
make.left.equalTo(lft_Label.snp.right).offset(10)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment