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

控制 100 字符限制

parent c6f8e424
......@@ -476,15 +476,16 @@ extension YHItemView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
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
}
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
}
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
}
......
......@@ -158,7 +158,7 @@ extension YHOtherTextViewItemView : UITextFieldDelegate {
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
if !text.isEmpty {
if textView.text.count > 999 {
if textView.text.count > 1999 {
return false
}
}
......
......@@ -166,6 +166,16 @@ extension YHCompanySelectViewController: UITextFieldDelegate {
textField.text = ""
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 {
......
......@@ -329,6 +329,10 @@ extension YHWorkIntroductionViewController: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let newText = (textField.text! as NSString).replacingCharacters(in: range, with: string)
if newText.count > 100 {
return false
}
dataSource.project_name = newText
return true
}
......
......@@ -476,7 +476,7 @@ extension YHWorkExperienceItemView: UITextFieldDelegate {
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
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
}
......@@ -488,10 +488,30 @@ extension YHWorkExperienceItemView: UITextFieldDelegate {
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
}
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()
data.message = newText
if let block = block {
......
......@@ -161,25 +161,25 @@ class YHInformationFillTipsAlertView: UIView {
let lable01 = UILabel(text: "信息填写提示")
lable01.textAlignment = .center
lable01.font = UIFont.PFSC_M(ofSize: 17)
lable01.textColor = UIColor.mainTextColor
topView.addSubview(lable01)
lable01.snp.makeConstraints { make in
make.left.equalTo(21)
make.right.equalTo(-21)
make.top.equalTo(16)
make.top.equalTo(kMargin)
make.centerX.equalToSuperview()
make.height.equalTo(24)
}
let line = UIView()
line.backgroundColor = UIColor(hexString: "#F0F0F0")
line.backgroundColor = UIColor.separatorColor
topView.addSubview(line)
line.snp.makeConstraints { make in
make.top.equalTo(lable01.snp.bottom).offset(12)
make.left.equalTo(21)
make.right.equalTo(-21)
make.top.equalTo(lable01.snp.bottom).offset(12)
make.height.equalTo(0.5)
make.bottom.equalToSuperview()
}
......
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