Questions tagged [uitextviewdelegate]

A text view delegate responds to editing-related messages from the text view. You can use the delegate to track changes to the text itself and to the current selection.

A text view delegate responds to editing-related messages from the text view. You can use the delegate to track changes to the text itself and to the current selection.

@property(nonatomic, assign) id<UITextViewDelegate> delegate

Available in iOS 2.0 and later.

225 questions
1
vote
2 answers

Swift resigning TextView from first responder

I have a TextField and a TextView in my ViewController. The ViewController follows both UITextFieldDelegate and UITextViewDelegate and their delegate methods. I want to resign the TextField or the TextView from being the first responder when the…
1
vote
1 answer

iOS Swift3 TextView line at wrong position

I have a textView which i use as an input field for chatMessages. I want it to expand if there is more text than could fit in one row. func textViewDidChange(_ textView: UITextView) { self.textViewHeight.constant =…
1
vote
2 answers

iOS UITextView delegate in another file

Good afternoon! Excuse me for my English. I've got a problem trying to assign textView's delegate to another class. I have a CommentsViewController and a ViewController in a storyBoard connected to it. I've got an UITextView element on…
Nikolay Pryahin
  • 377
  • 5
  • 19
1
vote
2 answers

Is it efficient to save text in Core Data in UITextView delegate method textViewDidChange?

I have multiple UITextView instances in my UIViewController and would like to save the typed-in text in Core Data when the view controller's view disappears or a specific button is clicked. Ideally, I would use the textViewDidEndEditing delegate…
1
vote
2 answers

How do I cut off the text view after 20 characters?

I am trying to limit the number of characters inside the text view to 20. After 20 it should instead have "...". The function is not firing and I am setting the delegate correctly. Animal class cell.pn.text = np[indexPath.row] cell.pn.selectable =…
manatee
  • 185
  • 1
  • 10
1
vote
4 answers

Close Keyboard when it's already visible

I have a problem to close keyboard when I have more than 1 UITextField. I have 2 TextField : TextField1 and TextField2 and I give each of them tag 1 and 2 I want to make if tag equal to 2 then it's hide the keyboard and if I touch textfield with tag…
Dirus
  • 1,033
  • 2
  • 14
  • 21
1
vote
1 answer

AttributedText in TextView while typing

I have a textView, and I am trying to give it an attributed text. I tried achieving it inside shouldChangeTextInRange, but it crashes for range out of index. func textView(textView: UITextView, shouldChangeTextInRange range: NSRange, replacementText…
senty
  • 12,385
  • 28
  • 130
  • 260
1
vote
3 answers

Application crashes with UITextViewDelegate

I'm new to iPhone programming and Objective-C and am having some trouble with my UITextView. I have a view with a text view as its subview. I created a separate class which I want to be the delgate of the text view. In my header for this delegate…
1
vote
1 answer

How to prevent keyboard display but allow paste UITextView

I have a UITextView that I would like to allow users to Paste into but not type into (not copy from or paste from) but not show the keyboard. I have tried the editable / selectable behaviors but they don't work. I have also tried…
MB.
  • 723
  • 1
  • 11
  • 28
1
vote
2 answers

Swift: hot to detect editing by user has stopped in a UITextView

I have a table view where two cells have UITextView into which the user can enter long data. Following some answers here in Stackoverflow, I implemented a protocol/delegate to detect when the user has finished entering the data which then will be…
SagittariusA
  • 5,289
  • 15
  • 73
  • 127
1
vote
1 answer

How to remember text attributes in UITextView when the user starts typing

I'm using a UITextView and I'm trying to have the text displayed using the attributedText property as the user types. Here's my current code: textView.attributedText = NSMutableAttributedString( string: "", attributes: [ …
Thomas
  • 2,356
  • 7
  • 23
  • 59
1
vote
1 answer

How can I get the length of text entered into UITextView as the user types?

I have aUITextView. I would like to have a way of updating aUILabel as the user times to indicate how many remaining characters are permitted? In theViewController theUITextView is referenced as IBOutlet UITextView *message; I have tried looking at…
Jack Shultz
  • 2,031
  • 2
  • 30
  • 53
1
vote
1 answer

iPhone: how can I activate a text field programmatically (and not wait for the user to touch it)

I have a UIViewController that is a UITextFieldDelegate, and I would like the keyboard for its text field to appear as soon as the user navigates to this view, without having to actually touch the text field. It would also be nice to be able to…
Paul
  • 231
  • 1
  • 4
  • 8
1
vote
2 answers

Swift growing UITextView using autolayout

I would like to autoresize UITextView similar to sms-app or whatsapp. I only found solution for objective-c and the example projects have too many code. I need this in Swift. Q: How can I resize the UITextView by font size while user is typing a…
masterWN
  • 85
  • 1
  • 9
1
vote
1 answer

How to dismiss keyboard for UITextView

The following triggers when the Done button is clicked on the keyboard. It goes into the conditional and returns false. However, the keyboard remains on the screen. class MyViewController: UIViewController, UITextViewDelegate{ func…
4thSpace
  • 43,672
  • 97
  • 296
  • 475