Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private var isPlaceholderActive: Bool {
- return textView.text == FeedbackView.feedbackPlaceholderText && textView.textColor == FeedbackView.feedbackPlaceholderTextColor
- }
- public func textViewDidBeginEditing(_ textView: UITextView) {
- if (isPlaceholderActive) {
- textView.text = ""
- textView.textColor = UIColor.black
- }
- }
- public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
- if (text == "\n") {
- textView.resignFirstResponder()
- if(!isPlaceholderActive) {
- forTextViewActionHiddenButton.sendActions(for: .touchUpInside)
- }
- }
- return true
- }
- public func textViewDidEndEditing(_ textView: UITextView) {
- if (textView.text.isEmpty) {
- textView.text = FeedbackView.feedbackPlaceholderText
- textView.textColor = FeedbackView.feedbackPlaceholderTextColor
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment