UITextView swift

自定义UITextView

image.png

lazy var txvRemark: MJPlaceTextView = {
        
        let view = MJPlaceTextView(placeholder: self.strPlaceholder, placeholderColor: UIColor.lightGray, frame: CGRect(x: 0, y: 15, width: kSCREEN_WIDTH, height: 110))
        NotificationCenter.default.addObserver(self, selector: #selector(textDidChange), name: .UITextViewTextDidChange, object: view.palceholdertextView)
        view.palceholdertextView.text = self.strContent
        view.palceholdertextView.mj_becomeFirstResponder { }

        return view
    }()

        view.addSubview(txvRemark)

UITextView 文本变化的监听

你可能感兴趣的:(UITextView swift)