Commit 34134a0f authored by pete谢兆麟's avatar pete谢兆麟

Merge commit '3e32816d' into xiezhaolin

parents ece05fbb 3e32816d
......@@ -263,6 +263,32 @@ extension YHChildBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
cell.title = detailItem.getTitle()
cell.text = detailItem.value
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
cell.textInputCondtion = {
textField in
if detailItem.type == .befourMarryFirstName { // 仅支持输入最多30个大写字母
let regex = "[^A-Z]+"
textField.limitInputWithPattern(pattern:regex, 30)
return true
}
var max = -1
if detailItem.type == .childName ||
detailItem.type == .everName {
max = 30
} else if detailItem.type == .birthCity ||
detailItem.type == .occupationName
{
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......
......@@ -389,7 +389,32 @@ extension YHSpouseBasicInfoVC : UITableViewDelegate, UITableViewDataSource {
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
cell.textInputCondtion = {
textField in
if detailItem.type == .befourMarryFirstName { // 仅支持输入最多30个大写字母
let regex = "[^A-Z]+"
textField.limitInputWithPattern(pattern:regex, 30)
return true
}
var max = -1
if detailItem.type == .spouseName ||
detailItem.type == .everName {
max = 30
} else if detailItem.type == .birthCity ||
detailItem.type == .occupationName
{
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
guard let self = self else { return }
......
......@@ -234,6 +234,23 @@ extension YHBrotherInfoVC : UITableViewDelegate, UITableViewDataSource {
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
cell.textInputCondtion = {
textField in
var max = -1
if detailItem.type == .brotherName {
max = 30
} else if detailItem.type == .birthCity {
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
......
......@@ -171,8 +171,6 @@ extension YHCertificateInfoController : UITableViewDelegate, UITableViewDataSour
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
......
......@@ -276,6 +276,26 @@ extension YHParentInfoVC : UITableViewDelegate, UITableViewDataSource {
} else {
cell.setTips(detailItem.tips, isShow: isNeedShowError && detailItem.isShowTips)
}
cell.textInputCondtion = {
textField in
var max = -1
if detailItem.type == .fatherName ||
detailItem.type == .motherName {
max = 30
} else if detailItem.type == .birthCity ||
detailItem.type == .occupationName
{
max = 100
}
if max > 0 {
if let textStr = textField.text {
textField.text = (textStr.count > max ? textStr[safe: ..<max] : textStr)
}
}
return true
}
cell.textChange = {
[weak self] (text, isEditEnd) in
......
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