Commit ce498ca3 authored by Steven杜宇's avatar Steven杜宇

// 发送好友申请

parent a8b27872
...@@ -27,6 +27,13 @@ class YHFriendRequestView: UIView { ...@@ -27,6 +27,13 @@ class YHFriendRequestView: UIView {
} }
} }
var isSendBtnEnabled = false {
didSet {
self.sendBtn.backgroundColor = (isSendBtnEnabled ? UIColor.brandMainColor : UIColor.brandMainColor30)
self.sendBtn.isUserInteractionEnabled = isSendBtnEnabled
}
}
// 底层蒙版 // 底层蒙版
lazy var blackMaskView: UIView = { lazy var blackMaskView: UIView = {
let view = UIView() let view = UIView()
...@@ -167,7 +174,7 @@ class YHFriendRequestView: UIView { ...@@ -167,7 +174,7 @@ class YHFriendRequestView: UIView {
} }
// 去除两端的空格 // 去除两端的空格
if var text = self.textView.text { if var text = self.textView.text {
text = text.trimmingCharacters(in: .whitespaces) text = text.getRealString()
if text.isEmpty { if text.isEmpty {
YHHUD.flash(message: "请输入发送申请信息") YHHUD.flash(message: "请输入发送申请信息")
return return
...@@ -209,6 +216,7 @@ class YHFriendRequestView: UIView { ...@@ -209,6 +216,7 @@ class YHFriendRequestView: UIView {
cardView.addSubview(cancelBtn) cardView.addSubview(cancelBtn)
cardView.addSubview(sendBtn) cardView.addSubview(sendBtn)
self.isSendBtnEnabled = false
blackMaskView.snp.makeConstraints { make in blackMaskView.snp.makeConstraints { make in
make.edges.equalToSuperview() make.edges.equalToSuperview()
...@@ -311,6 +319,7 @@ extension YHFriendRequestView: UITextViewDelegate { ...@@ -311,6 +319,7 @@ extension YHFriendRequestView: UITextViewDelegate {
func textViewDidChange(_ textView: UITextView) { func textViewDidChange(_ textView: UITextView) {
self.textCountLabel.text = "\(textView.text.count)/\(self.textMaxCount)" self.textCountLabel.text = "\(textView.text.count)/\(self.textMaxCount)"
self.placeHolderLabel.isHidden = !textView.text.isEmpty self.placeHolderLabel.isHidden = !textView.text.isEmpty
self.isSendBtnEnabled = !textView.text.isYHEmpty()
} }
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
......
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