Commit 7ea30b89 authored by David黄金龙's avatar David黄金龙

控制 100 字符限制

parent c6f8e424
...@@ -476,15 +476,16 @@ extension YHItemView: UITextFieldDelegate { ...@@ -476,15 +476,16 @@ extension YHItemView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string) var newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if (dataSource?.id == .id9 || dataSource?.id == .id21 || dataSource?.id == .id22 || dataSource?.id == .id23) && newText.count > 30 { if (dataSource?.id == .id21 || dataSource?.id == .id22 || dataSource?.id == .id23) && newText.count > 30 {
return false return false
} }
if (dataSource?.id == .id4 || dataSource?.id == .id32 || dataSource?.id == .id13 || dataSource?.id == .id18 || dataSource?.id == .id32 ) && newText.count > 100 { if (dataSource?.id == .id4 || dataSource?.id == .id32 || dataSource?.id == .id13 || dataSource?.id == .id32 || dataSource?.id == .id26 || dataSource?.id == .id34 ) && newText.count > 100 {
return false return false
} }
if (dataSource?.id == .id12 || dataSource?.id == .id17 || dataSource?.id == .id30) && newText.count > 50 { if (dataSource?.id == .id12 || dataSource?.id == .id17 || dataSource?.id == .id30 ||
dataSource?.id == .id9 || dataSource?.id == .id13 || dataSource?.id == .id18) && newText.count > 50 {
return false return false
} }
......
...@@ -158,7 +158,7 @@ extension YHOtherTextViewItemView : UITextFieldDelegate { ...@@ -158,7 +158,7 @@ extension YHOtherTextViewItemView : UITextFieldDelegate {
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if !text.isEmpty { if !text.isEmpty {
if textView.text.count > 999 { if textView.text.count > 1999 {
return false return false
} }
} }
......
...@@ -166,6 +166,16 @@ extension YHCompanySelectViewController: UITextFieldDelegate { ...@@ -166,6 +166,16 @@ extension YHCompanySelectViewController: UITextFieldDelegate {
textField.text = "" textField.text = ""
return true return true
} }
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
if string.count > 0 {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > 100 {
return false
}
}
return true
}
} }
extension YHCompanySelectViewController: UITableViewDelegate, UITableViewDataSource { extension YHCompanySelectViewController: UITableViewDelegate, UITableViewDataSource {
......
...@@ -329,6 +329,10 @@ extension YHWorkIntroductionViewController: UITextFieldDelegate { ...@@ -329,6 +329,10 @@ extension YHWorkIntroductionViewController: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string) let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > 100 {
return false
}
dataSource.project_name = newText dataSource.project_name = newText
return true return true
} }
......
...@@ -476,7 +476,7 @@ extension YHWorkExperienceItemView: UITextFieldDelegate { ...@@ -476,7 +476,7 @@ extension YHWorkExperienceItemView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string) let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if (dataSource?.id == .id1 || dataSource?.id == .id7 || dataSource?.id == .id8 || dataSource?.id == .id12 || dataSource?.id == .id14 || dataSource?.id == .id16 || dataSource?.id == .id18) && newText.count > 100 { if (dataSource?.id == .id1 || dataSource?.id == .id7 || dataSource?.id == .id8 || dataSource?.id == .id12 || dataSource?.id == .id14 || dataSource?.id == .id16 || dataSource?.id == .id18) && newText.count > 1 {
return false return false
} }
...@@ -488,10 +488,30 @@ extension YHWorkExperienceItemView: UITextFieldDelegate { ...@@ -488,10 +488,30 @@ extension YHWorkExperienceItemView: UITextFieldDelegate {
return false return false
} }
if dataSource?.id == .id17 && newText.count > 10 { if dataSource?.id == .id17 && newText.count > 14 {
//10万亿元 100000 000000000
// let target = 100000000000000
// if let value = Int64(newText) {
// if value > target {
// return false
// }
// } else {
// return false
// }
return false return false
} }
if dataSource?.id == .id12 && newText.count > 50 {
return false
}
if (dataSource?.id == .id14 || dataSource?.id == .id16 || dataSource?.id == .id18) && newText.count > 100 {
return false
}
var data = dataSource ?? YHWorkExperienceModel() var data = dataSource ?? YHWorkExperienceModel()
data.message = newText data.message = newText
if let block = block { if let block = block {
......
...@@ -161,25 +161,25 @@ class YHInformationFillTipsAlertView: UIView { ...@@ -161,25 +161,25 @@ class YHInformationFillTipsAlertView: UIView {
let lable01 = UILabel(text: "信息填写提示") let lable01 = UILabel(text: "信息填写提示")
lable01.textAlignment = .center
lable01.font = UIFont.PFSC_M(ofSize: 17) lable01.font = UIFont.PFSC_M(ofSize: 17)
lable01.textColor = UIColor.mainTextColor lable01.textColor = UIColor.mainTextColor
topView.addSubview(lable01) topView.addSubview(lable01)
lable01.snp.makeConstraints { make in lable01.snp.makeConstraints { make in
make.left.equalTo(21) make.top.equalTo(kMargin)
make.right.equalTo(-21) make.centerX.equalToSuperview()
make.top.equalTo(16)
make.height.equalTo(24) make.height.equalTo(24)
} }
let line = UIView() let line = UIView()
line.backgroundColor = UIColor(hexString: "#F0F0F0") line.backgroundColor = UIColor.separatorColor
topView.addSubview(line) topView.addSubview(line)
line.snp.makeConstraints { make in line.snp.makeConstraints { make in
make.top.equalTo(lable01.snp.bottom).offset(12)
make.left.equalTo(21) make.left.equalTo(21)
make.right.equalTo(-21) make.right.equalTo(-21)
make.top.equalTo(lable01.snp.bottom).offset(12)
make.height.equalTo(0.5) make.height.equalTo(0.5)
make.bottom.equalToSuperview() make.bottom.equalToSuperview()
} }
......
...@@ -57,7 +57,7 @@ extension YHInformationFillTipsCell { ...@@ -57,7 +57,7 @@ extension YHInformationFillTipsCell {
} }
//添加元素 //添加元素
let lable0 = UILabel(text: " 您好!欢迎来到香港优才申请系统,请按照实际情况填写。") let lable0 = UILabel(text: " 您好!欢迎来到香港优才申请系统,请按照实际情况填写。")
lable0.font = UIFont.PFSC_R(ofSize: 14) lable0.font = UIFont.PFSC_R(ofSize: 14)
lable0.textColor = UIColor.mainTextColor lable0.textColor = UIColor.mainTextColor
lable0.numberOfLines = 0 lable0.numberOfLines = 0
...@@ -70,12 +70,12 @@ extension YHInformationFillTipsCell { ...@@ -70,12 +70,12 @@ extension YHInformationFillTipsCell {
} }
let lable1 = UILabel(text: " 1. 如您填写途中想离开系统,记得点击保存,在您有空闲的时间再继续进行填写;") let lable1 = UILabel(text: " 1. 如您填写途中想离开系统,记得点击保存,在您有空闲的时间再继续进行填写;")
lable1.font = UIFont.PFSC_R(ofSize: 14) lable1.font = UIFont.PFSC_R(ofSize: 14)
lable1.textColor = UIColor.mainTextColor lable1.textColor = UIColor.mainTextColor
lable1.numberOfLines = 0 lable1.numberOfLines = 0
lable1.lineBreakMode = .byWordWrapping lable1.lineBreakMode = .byWordWrapping
let a: ASAttributedString = .init(" 1. 如您填写途中想离开系统,", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor)) let a: ASAttributedString = .init(" 1. 如您填写途中想离开系统,", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
let b: ASAttributedString = .init("记得点击保存", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.brandMainColor)) let b: ASAttributedString = .init("记得点击保存", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.brandMainColor))
let c: ASAttributedString = .init(",在您有空闲的时间再继续进行填写;", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor)) let c: ASAttributedString = .init(",在您有空闲的时间再继续进行填写;", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
lable1.attributed.text = a + b + c lable1.attributed.text = a + b + c
...@@ -86,13 +86,13 @@ extension YHInformationFillTipsCell { ...@@ -86,13 +86,13 @@ extension YHInformationFillTipsCell {
make.left.right.equalToSuperview() make.left.right.equalToSuperview()
} }
let lable2 = UILabel(text: " 2. 此次填写将花费您30-40分钟,系统将根据您所填写的信息,形成详细资料清单,一起为香港身份起航吧~") let lable2 = UILabel(text: " 2. 此次填写将花费您30-40分钟,系统将根据您所填写的信息,形成详细资料清单,一起为香港身份起航吧~")
lable2.font = UIFont.PFSC_R(ofSize: 14) lable2.font = UIFont.PFSC_R(ofSize: 14)
lable2.textColor = UIColor.mainTextColor lable2.textColor = UIColor.mainTextColor
lable2.numberOfLines = 0 lable2.numberOfLines = 0
lable2.lineBreakMode = .byWordWrapping lable2.lineBreakMode = .byWordWrapping
let aa: ASAttributedString = .init(" 2. 此次填写将花费您", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor)) let aa: ASAttributedString = .init(" 2. 此次填写将花费您", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
let bb: ASAttributedString = .init("30-40分钟", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.brandMainColor)) let bb: ASAttributedString = .init("30-40分钟", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.brandMainColor))
let cc: ASAttributedString = .init(",系统将根据您所填写的信息,形成详细资料清单,一起为香港身份起航吧~", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor)) let cc: ASAttributedString = .init(",系统将根据您所填写的信息,形成详细资料清单,一起为香港身份起航吧~", .font(UIFont.PFSC_R(ofSize: 14)),.foreground(UIColor.mainTextColor))
lable2.attributed.text = aa + bb + cc lable2.attributed.text = aa + bb + cc
......
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