Commit 33180eaf authored by David黄金龙's avatar David黄金龙

Merge commit 'b3264fb0' into davidhuang

* commit 'b3264fb0':
  配偶信息填写
  配偶信息填写
  配偶信息填写
parents 738f45ac b3264fb0
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import UIKit import UIKit
enum YHFamilyMemberEditType:Int { enum YHFormTitleItemEditType:Int {
case none = 1 case none = 1
case canEdit = 2 case canEdit = 2
case canCancel = 3 case canCancel = 3
...@@ -17,10 +17,10 @@ enum YHFamilyMemberEditType:Int { ...@@ -17,10 +17,10 @@ enum YHFamilyMemberEditType:Int {
class YHFamilyMemberFormVC: YHBaseViewController { class YHFamilyMemberFormVC: YHBaseViewController {
var familyMemberInfo: YHFamilyMemberInfo? var familyMemberInfo: YHFamilyMemberInfo?
var isChildsEditMode: YHFamilyMemberEditType = .none var isChildsEditMode: YHFormTitleItemEditType = .none
var isBrothersEditMode: YHFamilyMemberEditType = .none var isBrothersEditMode: YHFormTitleItemEditType = .none
var items:[[YHFamilyMemberProtocol]] = [] var items:[[YHFormItemProtocol]] = []
lazy var tableView: UITableView = { lazy var tableView: UITableView = {
...@@ -29,6 +29,7 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -29,6 +29,7 @@ class YHFamilyMemberFormVC: YHBaseViewController {
if #available(iOS 11.0, *) { if #available(iOS 11.0, *) {
tableView.contentInsetAdjustmentBehavior = .never tableView.contentInsetAdjustmentBehavior = .never
} }
tableView.showsVerticalScrollIndicator = false
tableView.backgroundColor = .clear tableView.backgroundColor = .clear
tableView.separatorStyle = .none tableView.separatorStyle = .none
tableView.delegate = self tableView.delegate = self
...@@ -59,7 +60,7 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -59,7 +60,7 @@ class YHFamilyMemberFormVC: YHBaseViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.gk_navTitle = "家庭成员信息填写" self.gk_navTitle = "家庭成员信息填写".local
view.backgroundColor = UIColor(hexString:"#F8F8F8") view.backgroundColor = UIColor(hexString:"#F8F8F8")
createUI() createUI()
loadData() loadData()
...@@ -274,12 +275,12 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -274,12 +275,12 @@ class YHFamilyMemberFormVC: YHBaseViewController {
// 配偶section // 配偶section
if let sponse = familyMemberInfo?.spouse { if let sponse = familyMemberInfo?.spouse {
let sponseArray:[YHFamilyMemberProtocol] = [YHFamilyMemberFormItem(type: .sponse), sponse] let sponseArray:[YHFormItemProtocol] = [YHFormTitleItem(type: .sponse), sponse]
items.append(sponseArray) items.append(sponseArray)
} }
// 父母section // 父母section
var parents = [YHFamilyMemberProtocol]() var parents = [YHFormItemProtocol]()
if let father = familyMemberInfo?.father { if let father = familyMemberInfo?.father {
parents.append(father) parents.append(father)
} }
...@@ -287,20 +288,20 @@ class YHFamilyMemberFormVC: YHBaseViewController { ...@@ -287,20 +288,20 @@ class YHFamilyMemberFormVC: YHBaseViewController {
parents.append(mother) parents.append(mother)
} }
if !parents.isEmpty { if !parents.isEmpty {
let item0 = YHFamilyMemberFormItem(type: .parent) let item0 = YHFormTitleItem(type: .parent)
parents.insert(item0, at: 0) parents.insert(item0, at: 0)
items.append(parents) items.append(parents)
} }
// 子女section // 子女section
var childArr:[YHFamilyMemberProtocol] = [YHFamilyMemberFormItem(type: .child), YHFamilyMemberFormItem(type: .addChild)] var childArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .child), YHFormAddItem(type: .addChild)]
if let childs = familyMemberInfo?.child, !childs.isEmpty { if let childs = familyMemberInfo?.child, !childs.isEmpty {
childArr.insert(contentsOf: childs, at:1) childArr.insert(contentsOf: childs, at:1)
} }
items.append(childArr) items.append(childArr)
// 兄妹section // 兄妹section
var brotherArr:[YHFamilyMemberProtocol] = [YHFamilyMemberFormItem(type: .brother), YHFamilyMemberFormItem(type: .addBrother)] var brotherArr:[YHFormItemProtocol] = [YHFormTitleItem(type: .brother), YHFormAddItem(type: .addBrother)]
if let brothers = familyMemberInfo?.brother, !brothers.isEmpty { if let brothers = familyMemberInfo?.brother, !brothers.isEmpty {
brotherArr.insert(contentsOf: brothers, at:1) brotherArr.insert(contentsOf: brothers, at:1)
} }
...@@ -486,27 +487,14 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -486,27 +487,14 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let arr = items[indexPath.section] let arr = items[indexPath.section]
let item:YHFamilyMemberProtocol = arr[indexPath.row] let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFamilyMemberFormItem { // 是标题或添加项目 if item is YHFormTitleItem { // 是标题
let formItem = item as! YHFormTitleItem
let formItem = item as! YHFamilyMemberFormItem
if formItem.type == .addChild || formItem.type == .addBrother { // 新增子女/兄弟姐妹
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell
createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.clickBlock = { [weak self] in
if formItem.type == .addBrother {
self?.addBrother()
} else if formItem.type == .addChild {
self?.addChild()
}
}
return cell
}
// 配偶父母子女兄妹title // 配偶父母子女兄妹title
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell let cell = tableView.dequeueReusableCell(withIdentifier: YHFormTitleCell.cellReuseIdentifier, for: indexPath) as! YHFormTitleCell
createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.titleLabel.text = formItem.getTitle() cell.titleLabel.text = formItem.getTitle()
cell.subTitleLabel.text = formItem.getSubTitle() cell.subTitleLabel.text = formItem.getSubTitle()
...@@ -539,12 +527,11 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -539,12 +527,11 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
} }
return cell return cell
} }
// 配偶父母子女兄妹具体条目 // 配偶父母子女兄妹具体条目
if item is YHParent || item is YHChild || item is YHSpouse || item is YHBrother { if item is YHParent || item is YHChild || item is YHSpouse || item is YHBrother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell let cell = tableView.dequeueReusableCell(withIdentifier: YHSingleLineSelectCell.cellReuseIdentifier, for: indexPath) as! YHSingleLineSelectCell
createCorner(cell: cell, arr: arr, indexPath: indexPath)
cell.isShowDeleteBtn = false cell.isShowDeleteBtn = false
cell.deleteBlock = nil cell.deleteBlock = nil
if item is YHChild || item is YHBrother { if item is YHChild || item is YHBrother {
...@@ -559,8 +546,8 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -559,8 +546,8 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
cell.deleteBlock = { [weak self] in cell.deleteBlock = { [weak self] in
if item is YHChild { if item is YHChild {
let childCount = self?.familyMemberInfo?.child?.count ?? 0 let childCount = self?.familyMemberInfo?.child?.count ?? 0
if (indexPath.row < childCount) { // 因为子女兄妹section第一行都是标题所以row-1
// 因为子女兄妹section第一行都是标题所以row-1 if (indexPath.row-1 < childCount) {
self?.familyMemberInfo?.child?.remove(at: indexPath.row-1) self?.familyMemberInfo?.child?.remove(at: indexPath.row-1)
self?.isChildsEditMode = .none self?.isChildsEditMode = .none
self?.isBrothersEditMode = .none self?.isBrothersEditMode = .none
...@@ -568,8 +555,8 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -568,8 +555,8 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
} else if item is YHBrother { } else if item is YHBrother {
let brotherCount = self?.familyMemberInfo?.brother?.count ?? 0 let brotherCount = self?.familyMemberInfo?.brother?.count ?? 0
if (indexPath.row < brotherCount) { // 因为子女兄妹section第一行都是标题所以row-1
// 因为子女兄妹section第一行都是标题所以row-1 if (indexPath.row-1 < brotherCount) {
self?.familyMemberInfo?.brother?.remove(at: indexPath.row-1) self?.familyMemberInfo?.brother?.remove(at: indexPath.row-1)
self?.isChildsEditMode = .none self?.isChildsEditMode = .none
self?.isBrothersEditMode = .none self?.isBrothersEditMode = .none
...@@ -581,25 +568,49 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -581,25 +568,49 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
return cell return cell
} }
// 新增子女/兄弟姐妹
if item is YHFormAddItem {
let formItem = item as! YHFormAddItem
if formItem.type == .addChild || formItem.type == .addBrother {
let cell = tableView.dequeueReusableCell(withIdentifier: YHFormAddInfoCell.cellReuseIdentifier, for: indexPath) as! YHFormAddInfoCell
cell.clickBlock = { [weak self] in
if formItem.type == .addBrother {
self?.addBrother()
} else if formItem.type == .addChild {
self?.addChild()
}
}
return cell
}
}
let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath) let cell = tableView.dequeueReusableCell(withIdentifier: "UITableViewCell", for: indexPath)
createCorner(cell: cell, arr: arr, indexPath: indexPath)
return cell return cell
} }
func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
if indexPath.section >= items.count { return }
let arr:[YHFormItemProtocol] = items[indexPath.section]
if indexPath.row >= arr.count { return }
createCorner(cell: cell, arr: arr, indexPath: indexPath)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let arr = items[indexPath.section] let arr = items[indexPath.section]
let item:YHFamilyMemberProtocol = arr[indexPath.row] let item:YHFormItemProtocol = arr[indexPath.row]
if item is YHFamilyMemberFormItem { // 是标题或添加项目 if item is YHFormTitleItem { // 是标题
let titleItem = item as! YHFamilyMemberFormItem
if titleItem.type == .addChild || titleItem.type == .addBrother {
return 77.0
}
return 52.0 return 52.0
} else if item is YHFormAddItem { // 新增子女兄妹
return 70.0
} }
return 64.0 return 50.0
} }
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
...@@ -612,8 +623,12 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource { ...@@ -612,8 +623,12 @@ extension YHFamilyMemberFormVC : UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHSpouseFormVC()
self.navigationController?.pushViewController(vc) if let spouse = familyMemberInfo?.spouse {
let vc = YHSpouseFormVC()
vc.spouse = spouse
self.navigationController?.pushViewController(vc)
}
} }
func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) { func createCorner(cell:UITableViewCell, arr:Array<Any>, indexPath:IndexPath) {
......
...@@ -108,22 +108,7 @@ class YHTableSubItemInfo { ...@@ -108,22 +108,7 @@ class YHTableSubItemInfo {
// 是否必填 // 是否必填
var isMust:Bool var isMust:Bool
// 是否随行
var isAccompany:Bool = false
// 港澳通信证
var isHongKongMacouPassport:Bool = false
// 国籍
var nation:String? = ""
/** 居住信息 **/
// 是否与主申请人同住
var isLiveTogether:Bool = false
// 现居住国家
var liveContry:String? = ""
// 现居住城市
var liveCity:String? = ""
// 现居住详细地址
var liveAddress:String? = ""
var title:String { var title:String {
return getTitle() return getTitle()
......
...@@ -9,28 +9,75 @@ ...@@ -9,28 +9,75 @@
import UIKit import UIKit
import SmartCodable import SmartCodable
enum YHFamilyMemberItemType:Int { protocol YHFormItemProtocol {
func getTitle() -> String
func getSubTitle() -> String
}
// 表单标题类型
enum YHFormTitleItemType:Int {
case sponse = 1 case sponse = 1
case parent = 2 case parent = 2
case child = 3 case child = 3
case brother = 4 case brother = 4
case addChild = 5
case addBrother = 6 case accompany = 5
case country = 6
case liveInfo = 7
case hkPassport = 8
} }
// 表单添加条目类型
enum YHFormAddItemType:Int {
case addChild = 1
case addBrother = 2
}
protocol YHFamilyMemberProtocol { // 表单具体条目类型
enum YHFormDetailItemType:Int {
func getTitle() -> String case accompany = 1
func getSubTitle() -> String case country = 2
case isLiveTother = 3
case liveContry = 4
case liveCity = 5
case detailAddress = 6
case hkPassport = 7
}
//添加item
class YHFormAddItem : YHFormItemProtocol
{
var type: YHFormAddItemType
init(type: YHFormAddItemType) {
self.type = type
}
func getTitle() -> String {
switch self.type {
case .addChild:
return "新增子女".local
case .addBrother:
return "新增兄弟姐妹".local
}
}
func getSubTitle() -> String {
return ""
}
} }
class YHFamilyMemberFormItem : YHFamilyMemberProtocol {
// 标题item
class YHFormTitleItem : YHFormItemProtocol {
var type: YHFamilyMemberItemType var type: YHFormTitleItemType
init(type: YHFamilyMemberItemType) { init(type: YHFormTitleItemType) {
self.type = type self.type = type
} }
...@@ -44,10 +91,14 @@ class YHFamilyMemberFormItem : YHFamilyMemberProtocol { ...@@ -44,10 +91,14 @@ class YHFamilyMemberFormItem : YHFamilyMemberProtocol {
return "兄弟姐妹".local return "兄弟姐妹".local
case .child: case .child:
return "子女".local return "子女".local
case .addChild: case .accompany:
return "新增子女".local return "随行".local
case .addBrother: case .country:
return "新增兄弟姐妹".local return "国籍".local
case .liveInfo:
return "居住信息".local
case .hkPassport:
return "港澳通行证".local
} }
} }
...@@ -61,14 +112,71 @@ class YHFamilyMemberFormItem : YHFamilyMemberProtocol { ...@@ -61,14 +112,71 @@ class YHFamilyMemberFormItem : YHFamilyMemberProtocol {
return String(format: "(%@)", "如无可不填".local) return String(format: "(%@)", "如无可不填".local)
case .child: case .child:
return String(format: "(%@)", "如无可不填".local) return String(format: "(%@)", "如无可不填".local)
case .addChild: case .accompany:
return "" return "".local
case .addBrother: case .country:
return "" return "".local
case .liveInfo:
return "".local
case .hkPassport:
return "".local
} }
} }
} }
// 具体item
class YHFormDetailItem : YHFormItemProtocol {
var type: YHFormDetailItemType
// 是否是必填项
var isNeed: Bool = true
// 是否随行
var isAccompany:Bool = false
// 港澳通信证
var isHongKongMacouPassport:Bool = false
// 国籍
var country:String? = ""
/** 居住信息 **/
// 是否与主申请人同住
var isLiveTogether:Bool = false
// 现居住国家
var liveContry:String? = ""
// 现居住城市
var liveCity:String? = ""
// 现居住详细地址
var liveAddress:String? = ""
init(type: YHFormDetailItemType) {
self.type = type
}
func getTitle() -> String {
switch type {
case .accompany:
return "是否随行至香港".local
case .country:
return String(format: "%@/%@", "国家".local, "地区".local)
case .isLiveTother:
return "是否与主申请人同住".local
case .liveContry:
return String(format: "%@/%@", "国家".local, "地区".local)
case .liveCity:
return String(format: "%@/%@", "国家".local, "地区".local)
case .detailAddress:
return "详细地址".local
case .hkPassport:
return "是否办理".local
}
}
func getSubTitle() -> String {
return ""
}
}
/* ***** ***** ***** ***** ***** ***** ***** ***** */ /* ***** ***** ***** ***** ***** ***** ***** ***** */
// MARK: - YHWelcome // MARK: - YHWelcome
...@@ -112,7 +220,7 @@ class YHFamilyMemberInfo: SmartCodable { ...@@ -112,7 +220,7 @@ class YHFamilyMemberInfo: SmartCodable {
} }
// MARK: - 子女初始信息 YHChild // MARK: - 子女初始信息 YHChild
class YHChild: SmartCodable, YHFamilyMemberProtocol { class YHChild: SmartCodable, YHFormItemProtocol {
var id: Int = -1 var id: Int = -1
var deceased: Int = -1 var deceased: Int = -1
...@@ -209,7 +317,7 @@ class YHChild: SmartCodable, YHFamilyMemberProtocol { ...@@ -209,7 +317,7 @@ class YHChild: SmartCodable, YHFamilyMemberProtocol {
} }
// MARK: - YHBrother // MARK: - YHBrother
class YHBrother: SmartCodable, YHFamilyMemberProtocol { class YHBrother: SmartCodable, YHFormItemProtocol {
var id: Int? = -1 var id: Int? = -1
var deceased: Int? = -1 var deceased: Int? = -1
var custody: Int? = -1 var custody: Int? = -1
...@@ -354,7 +462,7 @@ class YHSubsetNamePinyin: SmartCodable { ...@@ -354,7 +462,7 @@ class YHSubsetNamePinyin: SmartCodable {
} }
// MARK: - 父母信息 YHParent // MARK: - 父母信息 YHParent
class YHParent: SmartCodable, YHFamilyMemberProtocol { class YHParent: SmartCodable, YHFormItemProtocol {
var id: Int = -1 var id: Int = -1
var deceased: Int = -1 var deceased: Int = -1
var custody: Int = -1 var custody: Int = -1
...@@ -451,7 +559,7 @@ class YHParent: SmartCodable, YHFamilyMemberProtocol { ...@@ -451,7 +559,7 @@ class YHParent: SmartCodable, YHFamilyMemberProtocol {
} }
// MARK: - 配偶 YHSpouse // MARK: - 配偶 YHSpouse
class YHSpouse: SmartCodable, YHFamilyMemberProtocol { class YHSpouse: SmartCodable, YHFormItemProtocol {
var id: Int = -1 var id: Int = -1
var deceased: Int = -1 var deceased: Int = -1
var custody: Int = -1 var custody: Int = -1
......
...@@ -16,13 +16,15 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -16,13 +16,15 @@ class YHDoubleChoiceFormCell: UITableViewCell {
let btnTitleSelectColor = UIColor(hex: 0x4487F9) let btnTitleSelectColor = UIColor(hex: 0x4487F9)
let btnTitleDefaultColor = UIColor(hex:0x222222) let btnTitleDefaultColor = UIColor(hex:0x222222)
let btnBgColor = UIColor(hex:0xF8F9FB) let btnBgColor = UIColor(hex:0xF8F9FB)
let confirmTag = 9527 let negativeTag = 9527
let negativeTag = 9528 let confirmTag = 9528
var question:String? { var responseBlock:((Bool)->Void)?
var title:String? {
didSet { didSet {
if let question = question { if let question = title {
let str = "*"+question let str = "*"+question
let attributes: [NSAttributedString.Key: Any] = [ let attributes: [NSAttributedString.Key: Any] = [
.font: UIFont.PFSCR(ofSize: 14), .font: UIFont.PFSCR(ofSize: 14),
...@@ -31,13 +33,19 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -31,13 +33,19 @@ class YHDoubleChoiceFormCell: UITableViewCell {
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes) let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1) let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange) questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionLabel.attributedText = questionAttrStr titleLabel.attributedText = questionAttrStr
} }
} }
} }
var response:Bool = false {
didSet {
showResponse(response)
}
}
lazy var questionLabel: UILabel = { lazy var titleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.textColor = UIColor(hexString:"#333333") label.textColor = UIColor(hexString:"#333333")
label.textAlignment = .left label.textAlignment = .left
...@@ -82,15 +90,15 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -82,15 +90,15 @@ class YHDoubleChoiceFormCell: UITableViewCell {
self.selectionStyle = .none self.selectionStyle = .none
question = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? " title = " 1、是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪?是否曾在香港或其他地方因任何罪行或违法行为被定罪? "
contentView.addSubview(questionLabel) contentView.addSubview(titleLabel)
contentView.addSubview(negativeBtn) contentView.addSubview(negativeBtn)
contentView.addSubview(confirmBtn) contentView.addSubview(confirmBtn)
// 默认选择否按钮 // 默认选择否按钮
didClickResponseBtn(btn: negativeBtn) response = false
questionLabel.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)
make.left.equalToSuperview().offset(16) make.left.equalToSuperview().offset(16)
make.right.equalTo(confirmBtn.snp.left).offset(-8) make.right.equalTo(confirmBtn.snp.left).offset(-8)
...@@ -111,13 +119,16 @@ class YHDoubleChoiceFormCell: UITableViewCell { ...@@ -111,13 +119,16 @@ class YHDoubleChoiceFormCell: UITableViewCell {
} }
@objc func didClickResponseBtn(btn: UIButton) { @objc func didClickResponseBtn(btn: UIButton) {
let isConfirm = (btn.tag == confirmTag) response = (btn.tag == confirmTag)
if let responseBlock = responseBlock {
responseBlock(btn.tag==confirmTag)
}
}
func showResponse(_ isConfirm: Bool) {
confirmBtn.layer.borderColor = (isConfirm ? btnTitleSelectColor : .clear).cgColor confirmBtn.layer.borderColor = (isConfirm ? btnTitleSelectColor : .clear).cgColor
confirmBtn.setTitleColor((isConfirm ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal) confirmBtn.setTitleColor((isConfirm ? btnTitleSelectColor : btnTitleDefaultColor), for: .normal)
negativeBtn.layer.borderColor = (isConfirm ? .clear : btnTitleSelectColor).cgColor negativeBtn.layer.borderColor = (isConfirm ? .clear : btnTitleSelectColor).cgColor
negativeBtn.setTitleColor((isConfirm ? btnTitleDefaultColor: btnTitleSelectColor), for: .normal) negativeBtn.setTitleColor((isConfirm ? btnTitleDefaultColor: btnTitleSelectColor), for: .normal)
} }
} }
...@@ -14,7 +14,7 @@ class YHFormTitleCell: UITableViewCell { ...@@ -14,7 +14,7 @@ class YHFormTitleCell: UITableViewCell {
let editTag = 9527 let editTag = 9527
let cancelTag = 9528 let cancelTag = 9528
var rightClickBlock:((YHFamilyMemberEditType)->Void)? var rightClickBlock:((YHFormTitleItemEditType)->Void)?
lazy var titleLabel: UILabel = { lazy var titleLabel: UILabel = {
...@@ -111,7 +111,7 @@ class YHFormTitleCell: UITableViewCell { ...@@ -111,7 +111,7 @@ class YHFormTitleCell: UITableViewCell {
} }
} }
func showEditType(type: YHFamilyMemberEditType) { func showEditType(type: YHFormTitleItemEditType) {
switch type { switch type {
case .none: case .none:
cancelButton.isHidden = true cancelButton.isHidden = true
......
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