Commit 2a998c1b authored by David黄金龙's avatar David黄金龙

test

parent 0927cee8
......@@ -8,7 +8,7 @@
import UIKit
class YHBasicInfoFillView: UIView {
class YHBasicInfoFillView: UIView, UITextViewDelegate {
override init(frame: CGRect) {
super.init(frame: frame)
......@@ -103,7 +103,7 @@ class YHBasicInfoFillView: UIView {
]
let questionAttrStr = NSMutableAttributedString(string: str, attributes: attributes)
let starRange = NSRange(location: 0, length: 1)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(hex:0xFF3A3A), range: starRange)
questionAttrStr.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.failColor, range: starRange)
titleLabel.attributedText = questionAttrStr
}
}
......@@ -116,6 +116,10 @@ class YHBasicInfoFillView: UIView {
updateUI()
}
}
private var lastSelectedBtn : UIButton?
private var myTextView : UITextView!
}
......@@ -153,10 +157,40 @@ private extension YHBasicInfoFillView {
}
addSubview(additionHoldView)
additionHoldView.isHidden = true
let redStar = UILabel()
redStar.text = "*"
redStar.textColor = UIColor.failColor
additionHoldView.addSubview(redStar)
redStar.snp.makeConstraints { make in
make.left.equalTo(12)
make.top.equalTo(19)
make.width.height.equalTo(6)
}
let textView : UITextView = UITextView()
additionHoldView.addSubview(textView)
textView.snp.makeConstraints { make in
make.top.equalTo(redStar.snp.top).offset(-7)
make.left.equalTo(redStar.snp.right).offset(2)
make.right.equalTo(12)
make.height.lessThanOrEqualTo(66)
}
myTextView = textView
myTextView.delegate = self
}
@objc func didClickResponseBtn(btn: UIButton) {
printLog("点击了按钮哈 \(btn.tag)")
if lastSelectedBtn == btn {
printLog("连续点击了同一个按钮......")
return
}
lastSelectedBtn = btn
btn.isSelected = true
updateAnswerButton(btn, true)
......@@ -224,3 +258,23 @@ private extension YHBasicInfoFillView {
}
}
}
extension YHBasicInfoFillView : UITextFieldDelegate {
private func textViewDidBeginEditing (textView: UITextView) {
// if myTextView.textColor == ph_TextColor && myTextView.isFirstResponder() {
// myTextView.text = nil
// myTextView.textColor = .white
// }
}
private func textViewDidEndEditing (textView: UITextView) {
// if myTxtView.text.isEmpty || myTxtView.text == "" {
// myTxtView.textColor = .lightGray
// myTxtView.text = "Type your thoughts here..."
// }
}
}
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