Commit f710de92 authored by Steven杜宇's avatar Steven杜宇

// 分割线处理

parent 16a454d6
...@@ -198,7 +198,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -198,7 +198,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
let cellType = getCellType(detailItem) let cellType = getCellType(detailItem)
if cellType == .inputText { if cellType == .inputText {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemInputTextCell.cellReuseIdentifier, for: indexPath) as! YHFormItemInputTextCell
cell.isShowBottomLine = (indexPath.row != arr.count-1)
var isValueValid = false var isValueValid = false
if let value = detailItem.value, !value.isEmpty { if let value = detailItem.value, !value.isEmpty {
isValueValid = true isValueValid = true
...@@ -237,7 +236,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource { ...@@ -237,7 +236,6 @@ extension YHEducationDetailVC : UITableViewDelegate, UITableViewDataSource {
} else if cellType == .selectSheet { } else if cellType == .selectSheet {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemSelectSheetCell.cellReuseIdentifier, for: indexPath) as! YHFormItemSelectSheetCell
cell.isShowBottomLine = (indexPath.row != arr.count-1)
cell.isShowTipsButton = (detailItem.type == .degreeType) cell.isShowTipsButton = (detailItem.type == .degreeType)
cell.tipsBtnClickBlock = nil cell.tipsBtnClickBlock = nil
if detailItem.type == .degreeType { if detailItem.type == .degreeType {
......
...@@ -307,7 +307,6 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -307,7 +307,6 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
if eduInfo.vacantNum > 0 { // 有未填项 if eduInfo.vacantNum > 0 { // 有未填项
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.isShowBottomLine = (indexPath.row != eduList.count)
if let college = eduInfo.college, !college.isEmpty { if let college = eduInfo.college, !college.isEmpty {
cell.title = eduInfo.college cell.title = eduInfo.college
} else { } else {
...@@ -360,7 +359,6 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource { ...@@ -360,7 +359,6 @@ extension YHEducationInfoListVC : UITableViewDelegate, UITableViewDataSource {
// 第一行是标题 // 第一行是标题
let quaInfo:YHQualificationInfo = quaList[indexPath.row-1] let quaInfo:YHQualificationInfo = quaList[indexPath.row-1]
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.isShowBottomLine = (indexPath.row != quaList.count)
cell.title = "证书标题" cell.title = "证书标题"
if let qualification = quaInfo.qualification, !qualification.isEmpty { if let qualification = quaInfo.qualification, !qualification.isEmpty {
cell.title = qualification cell.title = qualification
......
...@@ -265,7 +265,6 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -265,7 +265,6 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.setTips(detailItem.tips, isShow: detailItem.isShowTips) cell.setTips(detailItem.tips, isShow: detailItem.isShowTips)
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.textChange = { cell.textChange = {
[weak self] (text, isEditEnd) in [weak self] (text, isEditEnd) in
guard let self = self else { return } guard let self = self else { return }
...@@ -305,7 +304,6 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -305,7 +304,6 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = detailItem.value cell.detail = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.setTips(detailItem.tips, isShow: detailItem.isShowTips) cell.setTips(detailItem.tips, isShow: detailItem.isShowTips)
return cell return cell
} }
...@@ -317,7 +315,6 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -317,7 +315,6 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = item.getTitle() cell.title = item.getTitle()
cell.answerArr = nil cell.answerArr = nil
cell.setTips(detailItem.tips, isShow: detailItem.isShowTips) cell.setTips(detailItem.tips, isShow: detailItem.isShowTips)
cell.isShowBottomLine = indexPath.row != arr.count-1
if detailItem.type == .birthNation { // 出生国家 if detailItem.type == .birthNation { // 出生国家
var select = false var select = false
......
...@@ -224,7 +224,6 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -224,7 +224,6 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.isShowBottomLine = indexPath.row != arr.count-1
var select = false var select = false
if let value = detailItem.value { if let value = detailItem.value {
...@@ -278,7 +277,6 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -278,7 +277,6 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = detailItem.value cell.detail = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
return cell return cell
} else if cellType == .inputText { // 输入文字cell } else if cellType == .inputText { // 输入文字cell
...@@ -287,7 +285,6 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -287,7 +285,6 @@ extension YHChildPrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.textChange = { cell.textChange = {
[weak self] (text, isEditEnd) in [weak self] (text, isEditEnd) in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -363,7 +363,6 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -363,7 +363,6 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
if detailItem.type == .hkIdentityCardNumber { // 输入香港身份证号码 if detailItem.type == .hkIdentityCardNumber { // 输入香港身份证号码
let isEmptyValue = isEmptyString(detailItem.value) let isEmptyValue = isEmptyString(detailItem.value)
...@@ -416,7 +415,6 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -416,7 +415,6 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = detailItem.value cell.detail = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips) cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
return cell return cell
...@@ -427,7 +425,6 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -427,7 +425,6 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = item.getTitle() cell.title = item.getTitle()
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.answerArr = nil cell.answerArr = nil
......
...@@ -179,7 +179,6 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -179,7 +179,6 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips) cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.isShowBottomLine = indexPath.row != arr.count-1
var select = false var select = false
if let value = detailItem.value { if let value = detailItem.value {
...@@ -234,7 +233,6 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -234,7 +233,6 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips) cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.detail = detailItem.value cell.detail = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
return cell return cell
} }
...@@ -247,7 +245,6 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -247,7 +245,6 @@ extension YHSpousePrimaryInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.text = detailItem.value cell.text = detailItem.value
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.setTips(detailItem.tips, isShow:detailItem.isShowTips) cell.setTips(detailItem.tips, isShow:detailItem.isShowTips)
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.textChange = { cell.textChange = {
[weak self] (text, isEditEnd) in [weak self] (text, isEditEnd) in
guard let self = self else { return } guard let self = self else { return }
......
...@@ -231,7 +231,6 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -231,7 +231,6 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.textChange = { cell.textChange = {
...@@ -263,7 +262,6 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -263,7 +262,6 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = detailItem.value cell.detail = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
return cell return cell
} }
...@@ -272,7 +270,6 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -272,7 +270,6 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = item.getTitle() cell.title = item.getTitle()
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.answerArr = nil cell.answerArr = nil
if detailItem.type == .birthNation { // 出生国家 if detailItem.type == .birthNation { // 出生国家
......
...@@ -181,7 +181,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour ...@@ -181,7 +181,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.placeHolder = detailItem.placeHolder cell.placeHolder = detailItem.placeHolder
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.textChange = { cell.textChange = {
[weak self] (text, isEditEnd) in [weak self] (text, isEditEnd) in
...@@ -221,7 +220,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour ...@@ -221,7 +220,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = detailItem.value cell.detail = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
return cell return cell
} }
...@@ -231,7 +229,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour ...@@ -231,7 +229,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = detailItem.value cell.detail = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
return cell return cell
} }
} }
......
...@@ -337,7 +337,6 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -337,7 +337,6 @@ extension YHFamilyMemberInfoVC : UITableViewDelegate, UITableViewDataSource {
let detailItem = item as! YHFamilyMember let detailItem = item as! YHFamilyMember
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemEnterDetailCell.cellReuseIdentifier, for: indexPath) as! YHFormItemEnterDetailCell
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.detailLabel.textColor = (isNeedShowError && detailItem.notFillNum > 0 ? .failColor : .labelTextColor2) cell.detailLabel.textColor = (isNeedShowError && detailItem.notFillNum > 0 ? .failColor : .labelTextColor2)
if detailItem.notFillNum > 0 { if detailItem.notFillNum > 0 {
......
...@@ -264,7 +264,6 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -264,7 +264,6 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.text = detailItem.value cell.text = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.textChange = { cell.textChange = {
...@@ -296,7 +295,6 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -296,7 +295,6 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = detailItem.getTitle() cell.title = detailItem.getTitle()
cell.detail = detailItem.value cell.detail = detailItem.value
cell.isShowBottomLine = indexPath.row != arr.count-1
return cell return cell
} }
...@@ -305,7 +303,6 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource { ...@@ -305,7 +303,6 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormItemDoubleChoiceCell.cellReuseIdentifier, for: indexPath) as! YHFormItemDoubleChoiceCell
cell.isMust = detailItem.isNeed cell.isMust = detailItem.isNeed
cell.title = item.getTitle() cell.title = item.getTitle()
cell.isShowBottomLine = indexPath.row != arr.count-1
cell.answerArr = nil cell.answerArr = nil
if detailItem.type == .birthNation { // 出生国家 if detailItem.type == .birthNation { // 出生国家
......
...@@ -81,10 +81,10 @@ class YHFormItemDoubleChoiceCell: UITableViewCell { ...@@ -81,10 +81,10 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
} }
} }
// 是否展示底部分割线 // 是否隐藏顶部分割线
var isShowBottomLine:Bool = false { var isHiddenTopLine:Bool = false {
didSet { didSet {
bottomLine.isHidden = !isShowBottomLine topLine.isHidden = isHiddenTopLine
} }
} }
...@@ -139,10 +139,9 @@ class YHFormItemDoubleChoiceCell: UITableViewCell { ...@@ -139,10 +139,9 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
return label return label
}() }()
private lazy var bottomLine:UIView = { private lazy var topLine:UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .separatorColor view.backgroundColor = .separatorColor
view.isHidden = true
return view return view
}() }()
...@@ -164,7 +163,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell { ...@@ -164,7 +163,7 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
contentView.addSubview(answer2Btn) contentView.addSubview(answer2Btn)
contentView.addSubview(answer1Btn) contentView.addSubview(answer1Btn)
contentView.addSubview(tipsLabel) contentView.addSubview(tipsLabel)
contentView.addSubview(bottomLine) contentView.addSubview(topLine)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
...@@ -186,11 +185,11 @@ class YHFormItemDoubleChoiceCell: UITableViewCell { ...@@ -186,11 +185,11 @@ class YHFormItemDoubleChoiceCell: UITableViewCell {
make.top.equalToSuperview().offset(16) make.top.equalToSuperview().offset(16)
} }
bottomLine.snp.makeConstraints { make in topLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap) make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap) make.right.equalToSuperview().offset(-horizonalGap)
make.height.equalTo(1.0) make.height.equalTo(1.0)
make.bottom.equalToSuperview() make.top.equalToSuperview()
} }
setTips("", isShow: false) setTips("", isShow: false)
......
...@@ -25,13 +25,13 @@ class YHFormItemEnterDetailCell: UITableViewCell { ...@@ -25,13 +25,13 @@ class YHFormItemEnterDetailCell: UITableViewCell {
arrowImgView.isHidden = isShowDeleteBtn arrowImgView.isHidden = isShowDeleteBtn
} }
} }
// 是否展示底部分割线 // 是否隐藏顶部分割线
var isShowBottomLine:Bool = false { var isHiddenTopLine:Bool = false {
didSet { didSet {
bottomLine.isHidden = !isShowBottomLine topLine.isHidden = isHiddenTopLine
} }
} }
var title:String? { var title:String? {
didSet { didSet {
...@@ -88,10 +88,9 @@ class YHFormItemEnterDetailCell: UITableViewCell { ...@@ -88,10 +88,9 @@ class YHFormItemEnterDetailCell: UITableViewCell {
return btn return btn
}() }()
private lazy var bottomLine:UIView = { private lazy var topLine:UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .separatorColor view.backgroundColor = .separatorColor
view.isHidden = true
return view return view
}() }()
...@@ -111,14 +110,14 @@ class YHFormItemEnterDetailCell: UITableViewCell { ...@@ -111,14 +110,14 @@ class YHFormItemEnterDetailCell: UITableViewCell {
contentView.addSubview(detailLabel) contentView.addSubview(detailLabel)
contentView.addSubview(arrowImgView) contentView.addSubview(arrowImgView)
contentView.addSubview(deleteButton) contentView.addSubview(deleteButton)
contentView.addSubview(bottomLine) contentView.addSubview(topLine)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.top.equalToSuperview().offset(16) make.top.equalToSuperview().offset(16)
make.left.equalToSuperview().offset(horizonalGap) make.left.equalToSuperview().offset(horizonalGap)
make.right.equalTo(detailLabel.snp.left).offset(-8) make.right.equalTo(detailLabel.snp.left).offset(-8)
make.bottom.equalTo(bottomLine.snp.top).offset(-16) make.bottom.equalToSuperview().offset(-16)
} }
detailLabel.snp.makeConstraints { make in detailLabel.snp.makeConstraints { make in
...@@ -139,11 +138,11 @@ class YHFormItemEnterDetailCell: UITableViewCell { ...@@ -139,11 +138,11 @@ class YHFormItemEnterDetailCell: UITableViewCell {
make.right.equalToSuperview() make.right.equalToSuperview()
} }
bottomLine.snp.makeConstraints { make in topLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap) make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap) make.right.equalToSuperview().offset(-horizonalGap)
make.height.equalTo(1.0) make.height.equalTo(1.0)
make.bottom.equalToSuperview() make.top.equalToSuperview()
} }
} }
......
...@@ -21,10 +21,10 @@ class YHFormItemExpireDateCell: UITableViewCell { ...@@ -21,10 +21,10 @@ class YHFormItemExpireDateCell: UITableViewCell {
var placeHolder:String? = "请选择" var placeHolder:String? = "请选择"
var clickBlock:(()->Void)? var clickBlock:(()->Void)?
// 是否展示底部分割线 // 是否隐藏顶部分割线
var isShowBottomLine:Bool = false { var isHiddenTopLine:Bool = false {
didSet { didSet {
bottomLine.isHidden = !isShowBottomLine topLine.isHidden = isHiddenTopLine
} }
} }
...@@ -105,10 +105,9 @@ class YHFormItemExpireDateCell: UITableViewCell { ...@@ -105,10 +105,9 @@ class YHFormItemExpireDateCell: UITableViewCell {
return label return label
}() }()
private lazy var bottomLine:UIView = { private lazy var topLine:UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .separatorColor view.backgroundColor = .separatorColor
view.isHidden = true
return view return view
}() }()
...@@ -130,7 +129,7 @@ class YHFormItemExpireDateCell: UITableViewCell { ...@@ -130,7 +129,7 @@ class YHFormItemExpireDateCell: UITableViewCell {
contentView.addSubview(detailLabel) contentView.addSubview(detailLabel)
contentView.addSubview(longTimeBtn) contentView.addSubview(longTimeBtn)
contentView.addSubview(tipsLabel) contentView.addSubview(tipsLabel)
contentView.addSubview(bottomLine) contentView.addSubview(topLine)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap) make.left.equalToSuperview().offset(horizonalGap)
...@@ -150,11 +149,11 @@ class YHFormItemExpireDateCell: UITableViewCell { ...@@ -150,11 +149,11 @@ class YHFormItemExpireDateCell: UITableViewCell {
make.centerY.equalTo(titleLabel) make.centerY.equalTo(titleLabel)
} }
bottomLine.snp.makeConstraints { make in topLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap) make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap) make.right.equalToSuperview().offset(-horizonalGap)
make.height.equalTo(1.0) make.height.equalTo(1.0)
make.bottom.equalToSuperview() make.top.equalToSuperview()
} }
setTips("", isShow: false) setTips("", isShow: false)
......
...@@ -14,10 +14,10 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -14,10 +14,10 @@ class YHFormItemInputTextCell: UITableViewCell {
let horizonalGap = 18.0 let horizonalGap = 18.0
// 是否必填 如必填title会展示红色* // 是否必填 如必填title会展示红色*
var isMust = false var isMust = false
// 是否展示底部分割线 // 是否隐藏顶部分割线
var isShowBottomLine:Bool = false { var isHiddenTopLine:Bool = false {
didSet { didSet {
bottomLine.isHidden = !isShowBottomLine topLine.isHidden = isHiddenTopLine
} }
} }
// BOOL值表示编辑是否结束 // BOOL值表示编辑是否结束
...@@ -91,10 +91,9 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -91,10 +91,9 @@ class YHFormItemInputTextCell: UITableViewCell {
return label return label
}() }()
private lazy var bottomLine:UIView = { private lazy var topLine:UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .separatorColor view.backgroundColor = .separatorColor
view.isHidden = true
return view return view
}() }()
...@@ -113,7 +112,7 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -113,7 +112,7 @@ class YHFormItemInputTextCell: UITableViewCell {
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
contentView.addSubview(textField) contentView.addSubview(textField)
contentView.addSubview(tipsLabel) contentView.addSubview(tipsLabel)
contentView.addSubview(bottomLine) contentView.addSubview(topLine)
isMust = true isMust = true
...@@ -129,11 +128,11 @@ class YHFormItemInputTextCell: UITableViewCell { ...@@ -129,11 +128,11 @@ class YHFormItemInputTextCell: UITableViewCell {
make.left.equalTo(titleLabel.snp.right).offset(10) make.left.equalTo(titleLabel.snp.right).offset(10)
} }
bottomLine.snp.makeConstraints { make in topLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap) make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap) make.right.equalToSuperview().offset(-horizonalGap)
make.height.equalTo(1.0) make.height.equalTo(1.0)
make.bottom.equalToSuperview() make.top.equalToSuperview()
} }
setTips("", isShow: false) setTips("", isShow: false)
......
...@@ -11,7 +11,7 @@ import UIKit ...@@ -11,7 +11,7 @@ import UIKit
class YHFormItemQuestionsCell: UITableViewCell { class YHFormItemQuestionsCell: UITableViewCell {
static let cellReuseIdentifier = "YHFormItemQuestionsCell" static let cellReuseIdentifier = "YHFormItemQuestionsCell"
let horizonalGap = 18.0
private let btnWidth = 70.0 private let btnWidth = 70.0
private let btnHeight = 32.0 private let btnHeight = 32.0
private let btnTitleSelectColor = UIColor.brandMainColor private let btnTitleSelectColor = UIColor.brandMainColor
...@@ -67,6 +67,13 @@ class YHFormItemQuestionsCell: UITableViewCell { ...@@ -67,6 +67,13 @@ class YHFormItemQuestionsCell: UITableViewCell {
} }
} }
// 是否隐藏顶部分割线
var isHiddenTopLine:Bool = false {
didSet {
topLine.isHidden = isHiddenTopLine
}
}
// 更新答案按钮选中状态 // 更新答案按钮选中状态
private func updateAnswerButton(_ btn:UIButton, _ isSelect:Bool) { private func updateAnswerButton(_ btn:UIButton, _ isSelect:Bool) {
btn.layer.borderColor = (isSelect ? btnTitleSelectColor : .clear).cgColor btn.layer.borderColor = (isSelect ? btnTitleSelectColor : .clear).cgColor
...@@ -114,6 +121,22 @@ class YHFormItemQuestionsCell: UITableViewCell { ...@@ -114,6 +121,22 @@ class YHFormItemQuestionsCell: UITableViewCell {
btn.addTarget(self, action: #selector(didClickResponseBtn(btn:)), for: .touchUpInside) btn.addTarget(self, action: #selector(didClickResponseBtn(btn:)), for: .touchUpInside)
return btn return btn
}() }()
private lazy var tipsLabel: UILabel = {
let label = UILabel()
label.textColor = .failColor
label.textAlignment = .left
label.numberOfLines = 0
label.font = UIFont.PFSC_R(ofSize: 12)
label.isHidden = true
return label
}()
private lazy var topLine:UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
...@@ -132,6 +155,8 @@ class YHFormItemQuestionsCell: UITableViewCell { ...@@ -132,6 +155,8 @@ class YHFormItemQuestionsCell: UITableViewCell {
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
contentView.addSubview(answer2Btn) contentView.addSubview(answer2Btn)
contentView.addSubview(answer1Btn) contentView.addSubview(answer1Btn)
contentView.addSubview(tipsLabel)
contentView.addSubview(topLine)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
make.top.equalTo(contentView.snp.top).offset(22) make.top.equalTo(contentView.snp.top).offset(22)
...@@ -151,6 +176,38 @@ class YHFormItemQuestionsCell: UITableViewCell { ...@@ -151,6 +176,38 @@ class YHFormItemQuestionsCell: UITableViewCell {
make.left.equalTo(answer1Btn.snp.right).offset(16) make.left.equalTo(answer1Btn.snp.right).offset(16)
make.centerY.equalTo(answer1Btn) make.centerY.equalTo(answer1Btn)
} }
topLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.height.equalTo(1.0)
make.top.equalToSuperview()
}
setTips("", isShow: false)
}
func setTips(_ tips:String?, isShow:Bool) {
tipsLabel.text = tips
tipsLabel.isHidden = !isShow
if isShow {
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.top.equalTo(answer1Btn.snp.bottom)
make.bottom.equalToSuperview().offset(-16)
}
} else {
tipsLabel.snp.remakeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.top.equalTo(answer1Btn.snp.bottom)
make.height.equalTo(0)
make.bottom.equalToSuperview().offset(-16)
}
}
self.setNeedsLayout()
self.layoutIfNeeded()
} }
......
...@@ -57,10 +57,10 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -57,10 +57,10 @@ class YHFormItemSelectSheetCell: UITableViewCell {
} }
} }
// 是否展示底部分割线 // 是否隐藏顶部分割线
var isShowBottomLine:Bool = false { var isHiddenTopLine:Bool = false {
didSet { didSet {
bottomLine.isHidden = !isShowBottomLine topLine.isHidden = isHiddenTopLine
} }
} }
...@@ -111,10 +111,9 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -111,10 +111,9 @@ class YHFormItemSelectSheetCell: UITableViewCell {
return label return label
}() }()
private lazy var bottomLine:UIView = { private lazy var topLine:UIView = {
let view = UIView() let view = UIView()
view.backgroundColor = .separatorColor view.backgroundColor = .separatorColor
view.isHidden = true
return view return view
}() }()
...@@ -134,7 +133,7 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -134,7 +133,7 @@ class YHFormItemSelectSheetCell: UITableViewCell {
contentView.addSubview(detailLabel) contentView.addSubview(detailLabel)
contentView.addSubview(arrowImgView) contentView.addSubview(arrowImgView)
contentView.addSubview(tipsLabel) contentView.addSubview(tipsLabel)
contentView.addSubview(bottomLine) contentView.addSubview(topLine)
contentView.addSubview(tipsButton) contentView.addSubview(tipsButton)
titleLabel.snp.makeConstraints { make in titleLabel.snp.makeConstraints { make in
...@@ -161,11 +160,11 @@ class YHFormItemSelectSheetCell: UITableViewCell { ...@@ -161,11 +160,11 @@ class YHFormItemSelectSheetCell: UITableViewCell {
make.centerY.equalTo(detailLabel) make.centerY.equalTo(detailLabel)
} }
bottomLine.snp.makeConstraints { make in topLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap) make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap) make.right.equalToSuperview().offset(-horizonalGap)
make.height.equalTo(1.0) make.height.equalTo(1.0)
make.bottom.equalToSuperview() make.top.equalToSuperview()
} }
setTips("", isShow: false) setTips("", isShow: false)
......
...@@ -79,12 +79,6 @@ class YHFormItemTitleCell: UITableViewCell { ...@@ -79,12 +79,6 @@ class YHFormItemTitleCell: UITableViewCell {
return btn return btn
}() }()
lazy var bottomLine:UIView = {
let view = UIView()
view.backgroundColor = .separatorColor
return view
}()
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
} }
...@@ -98,7 +92,6 @@ class YHFormItemTitleCell: UITableViewCell { ...@@ -98,7 +92,6 @@ class YHFormItemTitleCell: UITableViewCell {
self.selectionStyle = .none self.selectionStyle = .none
contentView.addSubview(titleLabel) contentView.addSubview(titleLabel)
contentView.addSubview(bottomLine)
contentView.addSubview(editButton) contentView.addSubview(editButton)
contentView.addSubview(cancelButton) contentView.addSubview(cancelButton)
...@@ -120,13 +113,6 @@ class YHFormItemTitleCell: UITableViewCell { ...@@ -120,13 +113,6 @@ class YHFormItemTitleCell: UITableViewCell {
make.centerY.equalTo(editButton) make.centerY.equalTo(editButton)
make.right.equalToSuperview() make.right.equalToSuperview()
} }
bottomLine.snp.makeConstraints { make in
make.left.equalToSuperview().offset(horizonalGap)
make.right.equalToSuperview().offset(-horizonalGap)
make.height.equalTo(1.0)
make.bottom.equalToSuperview()
}
} }
func showEditType(type: YHFormTitleItemEditType) { func showEditType(type: YHFormTitleItemEditType) {
...@@ -146,7 +132,7 @@ class YHFormItemTitleCell: UITableViewCell { ...@@ -146,7 +132,7 @@ class YHFormItemTitleCell: UITableViewCell {
titleMaxRight = -(horizonalGap+92.0+5.0) titleMaxRight = -(horizonalGap+92.0+5.0)
} }
titleLabel.snp.updateConstraints { make in titleLabel.snp.updateConstraints { make in
make.right.equalToSuperview().offset(-horizonalGap) make.right.equalToSuperview().offset(titleMaxRight)
} }
self.setNeedsLayout() self.setNeedsLayout()
self.layoutIfNeeded() self.layoutIfNeeded()
......
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