Commit 86b29e91 authored by Steven杜宇's avatar Steven杜宇

// 学历提示按钮

parent 8d94eac1
......@@ -239,6 +239,15 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} else if cellType == .selectSheet {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isShowBottomLine = (indexPath.row != arr.count-1)
cell.isShowTipsButton = (detailItem.type == .degreeType)
cell.tipsBtnClickBlock = nil
if detailItem.type == .degreeType {
cell.tipsBtnClickBlock = {
[weak self] in
guard let self = self else { return }
YHHUD.flash(message: "该内容在学位证上,通常是授予后面,如授予“理学”学士学位,则填理学")
}
}
cell.placeHolder = detailItem.placeHolder
cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle()
......
......@@ -20,6 +20,7 @@ class YHFormItemSelectSheetCell: UITableViewCell {
// 是否必填 如必填title会展示红色*
var isMust = false
var placeHolder:String?
var tipsBtnClickBlock:(()->Void)?
var title:String? {
didSet {
......@@ -37,7 +38,7 @@ class YHFormItemSelectSheetCell: UITableViewCell {
}
titleLabel.attributedText = questionAttrStr
} else {
titleLabel.text = ""
titleLabel.attributedText = nil
}
}
}
......@@ -63,6 +64,13 @@ class YHFormItemSelectSheetCell: UITableViewCell {
}
}
// 是否展示标题旁的提示!按钮
var isShowTipsButton:Bool = false {
didSet {
tipsButton.isHidden = !isShowTipsButton
}
}
private lazy var titleLabel: UILabel = {
let label = UILabel()
label.textColor = titleColor
......@@ -80,6 +88,14 @@ class YHFormItemSelectSheetCell: UITableViewCell {
return label
}()
private lazy var tipsButton: UIButton = {
let btn = UIButton()
btn.setImage(UIImage(named: "form_btn_tips"), for: .normal)
btn.addTarget(self, action: #selector(didTipsButtonClicked), for: .touchUpInside)
btn.isHidden = true
return btn
}()
private lazy var arrowImgView: UIImageView = {
let imgView = UIImageView(image: UIImage(named: "form_right_arrow"))
return imgView
......@@ -119,16 +135,23 @@ class YHFormItemSelectSheetCell: UITableViewCell {
contentView.addSubview(arrowImgView)
contentView.addSubview(tipsLabel)
contentView.addSubview(bottomLine)
contentView.addSubview(tipsButton)
titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalTo(detailLabel.snp.left).offset(-8)
make.width.equalTo(120)
make.width.lessThanOrEqualTo(120)
}
tipsButton.snp.makeConstraints { make in
make.centerY.equalTo(titleLabel)
make.left.equalTo(titleLabel.snp.right).offset(0)
make.width.height.equalTo(16.0)
}
detailLabel.snp.makeConstraints { make in
make.top.equalTo(titleLabel)
make.left.equalToSuperview().offset(horizonalGap+120+8)
make.right.equalTo(arrowImgView.snp.left)
}
......@@ -148,6 +171,12 @@ class YHFormItemSelectSheetCell: UITableViewCell {
setTips("", isShow: false)
}
@objc func didTipsButtonClicked() {
if let tipsBtnClickBlock = tipsBtnClickBlock {
tipsBtnClickBlock()
}
}
func setTips(_ tips:String?, isShow:Bool) {
tipsLabel.text = tips
tipsLabel.isHidden = !isShow
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Frame@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Frame@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment