@IBOutlet weak var AddCommentsButton: UIButton!
@IBOutlet weak var AddCommentsTextView: UITextView!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
self.AddCommentsButton.setTitle("Add Comments", for: UIControl.State.normal)
self.AddCommentsButton.setTitleColor(UIColor.blue, for: UIControl.State.normal)
AddCommentsTextView.rchDelegate = self as? RCHTextViewDelegate
AddCommentsTextView.delegate = self as? UITextViewDelegate
AddCommentsTextView.placeholder = "Leave a comment"
AddCommentsTextView.canShowBorder = true
AddCommentsTextView.addBorderWithCornerRadius(cornerRadius: 0, borderColor: .Gray, borderWidth: 0.5)
AddCommentsTextView.backgroundColor = UIColor.clear
self.AddCommentsTextView.font = UIFont.dynamicFont(control: .listKeyText)
self.AddCommentsTextView.textColor = UIColor.listKeyTextColor()
}
@IBAction func didTapAddCommentsButton(_ sender: Any) {
}
Asked
Active
Viewed 23 times
0

Parth Bhatt
- 19,381
- 28
- 133
- 216

Gouse Jani
- 1
- 1
-
You want to enable/disable a UITextView? https://stackoverflow.com/questions/10067853/uitextview-how-to-really-disable-editing – Warren Burton May 11 '20 at 11:04
-
Does this answer your question? [UITextView: How to really disable editing?](https://stackoverflow.com/questions/10067853/uitextview-how-to-really-disable-editing) – Dilan May 11 '20 at 11:10
1 Answers
0
If you are looking for when you click on didTapAddCommentsButton button then the AddCommentsTextView Textview should show the cursor in the textview for entering the text then you can use:
@IBAction func didTapAddCommentsButton(_ sender: Any) {
self.AddCommentsTextView.becomeFirstResponder()
}
So that on button click it will enable textview cursor for entering purpose.
UPDATED:
If you want to remove focus from the text entry then use:
self.AddCommentsTextView.resignFirstResponder()

Ashwini Salunkhe
- 224
- 2
- 12
-
previously the text view must be disable. if we click on the button then only the textview must be enable. – Gouse Jani May 12 '20 at 05:49
-
Please check updated answer. It may help you. Textfield will enable only when button clicked else you can put disable code where you want to disable text entry.. What issue now your facing in this? – Ashwini Salunkhe May 12 '20 at 06:24