Commit a59e414b authored by 刘俊宏's avatar 刘俊宏

完善联系人信息

parent 2a4ba4b7
...@@ -10,8 +10,8 @@ import UIKit ...@@ -10,8 +10,8 @@ import UIKit
import LGButton import LGButton
import ContactsUI import ContactsUI
class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate{ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate,UITextViewDelegate{
@IBOutlet weak var messageCountLbl: UILabel! @IBOutlet weak var messageCountLbl: UILabel!
@IBOutlet weak var messageTV: UITextView! @IBOutlet weak var messageTV: UITextView!
@IBOutlet weak var userPhoneTF: UITextField! @IBOutlet weak var userPhoneTF: UITextField!
...@@ -22,9 +22,11 @@ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate ...@@ -22,9 +22,11 @@ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate
super.viewDidLoad() super.viewDidLoad()
navbar.title = "下单联系人信息" navbar.title = "下单联系人信息"
self.view.addSubview(navbar) self.view.addSubview(navbar)
SetTopFrame(view: contentV, height: 370) SetTopFrame(view: contentV, height: 370)
} messageTV.delegate = self
}
@IBAction func gotoPhoneAccoutAction(_ sender: UIButton) { @IBAction func gotoPhoneAccoutAction(_ sender: UIButton) {
print("gotoPhoneAccoutAction-获取通讯录") print("gotoPhoneAccoutAction-获取通讯录")
//联系人选择控制器 //联系人选择控制器
...@@ -52,14 +54,30 @@ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate ...@@ -52,14 +54,30 @@ class XiaDanUserInfoViewController: BaseViewController , CNContactPickerDelegate
for str in strarr { for str in strarr {
phone = phone + str phone = phone + str
} }
} }
userPhoneTF.text = phone userPhoneTF.text = phone
} }
} }
@IBAction func sureUserInfoAction(_ sender: LGButton) { @IBAction func sureUserInfoAction(_ sender: LGButton) {
print("sureUserInfoAction-确定") print("sureUserInfoAction-确定")
}
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
messageCountLbl.text = "(\(textView.text.count)/200)"
if (textView.text.count == 200)
{
textView.text = textView.text.subString(start: 0, length: 200)
}
return true
}
func textViewDidChange(_ textView: UITextView) {
if textView.markedTextRange == nil {
if textView.text.count > 200 {
textView.text = textView.text.subString(start: 0, length: 200)
}
}
} }
} }
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