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
3
votes
4 answers

How to create a new line by tapping the return key in UITextView ios

I am newly to iPhone. I have added one UITextView using XIB in my application, now after tapping on done key it's simply resigning the keyboard. But, I want to create a new line by tapping it, means it should go to the next paragraph. Please help me…
user2786
  • 656
  • 4
  • 13
  • 35
3
votes
3 answers

textView resignFirstResponder not firing UIKeyboardWillHideNotification

I have a UIView which contains UITexView and a Button. I have a delegate UITextViewDelegate. When I first set the cursor on the UITextView, the delegate function "textViewShouldEndEditing" gets called, and this function triggers the…
Grace
  • 1,265
  • 21
  • 47
3
votes
0 answers

UITextView autocompletion of custom text

I have UITextView in which as the user types I would like to suggest a few words (like in a popup) as is displayed for misspelled words. There are custom words that I have in a an array which should be used as suggestions For example if the user…
user1046037
  • 16,755
  • 12
  • 92
  • 138
2
votes
4 answers

UIText view delegate issue

I want to resign keyboard from UItextview. How to implement UItextView delegate method programmatically.
gauri
  • 71
  • 3
2
votes
2 answers

Detect linebreak in UITextView

Is there a way to detect line breaks occurred by the user or when the textview automatically changes line. I am going to change the height of the textview depending on the number of lines. Any help appreciated.
stefanosn
  • 3,264
  • 10
  • 53
  • 79
2
votes
2 answers

"self.delegate = self" not working on iOS using ARC

I am working on an iOS SDK 4 project with ARC enabled. My class MyTextView (derived from UITextView with UITextViewDelegate protocol) implements the following static method: + (void)showInViewController:(UIViewController*)viewController { …
2
votes
1 answer

Resizable UITextView Has sizeThatFits That Gives Wrong Size in UIViewRepresentable

I am using a UITextView in a SwiftUI app in order to get a list of editable, multiline text fields based on this answer: How do I create a multiline TextField in SwiftUI? I use the component in SwiftUI like this: @State private var textHeight:…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
2
votes
3 answers

UITextView observe text changes

I want to listen for every text change in UITextView. The setup is very trivial. override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) NotificationCenter.default.addObserver( self, selector:…
evilgeniuz
  • 346
  • 5
  • 18
2
votes
1 answer

iPhone: Is it safe to call textViewDidChange?

I'm looking at code in a UIViewController that conforms to the UITextViewDelegate protocol and has an instance variable called someTextView. someTextView.text = @"some text"; [self textViewDidChange:someTextView]; Is that safe? That doesn't look…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
2
votes
1 answer

Delete Slide-to-type by word in UITextView gives incorrect range in `shouldChangeText` delegate method

I have a UITextView in a ViewController. I've implemented shouldChangeTextInRange delegate method from UITextViewDelegate. The range value I obtain through the above delegate method for deleting a single character is something like {location, 1}.…
2
votes
1 answer

Expand UITextView and then scroll after certain point

I have been struggling to set create this, I have read numerous posts on here, but do not understand what I am doing wrong. I have a UITextView. I would like it to expand in height, up to a number and then fix at that height with scrolling…
Tim J
  • 1,211
  • 1
  • 14
  • 31
2
votes
2 answers

Completely disable 'backspace' being pressed Swift

I'm working on an app where the user needs to be able to type 'forwards' but is not able to delete anything (to go back and edit for example) that has already been typed. There are a few answers that are roughly what I want : how to handle backspace…
nc14
  • 539
  • 1
  • 8
  • 26
2
votes
1 answer

Detect keyboard combinations that change text

I have a library I’m building that needs to keep track of text entry into a UITextView in order to keep track of positions of certain sections of text. Most cases are handled fine within the textView(_:shouldChangeTextIn:replacementText:) method.…
Steve
  • 921
  • 1
  • 7
  • 18
2
votes
3 answers

textViewDidBeginEditing on 2 separate textViews in swift

I have 2 separate textViews that I want to trigger an event when each of them are tapped. the termTextView triggers fine, but when termTextView is triggered first, the definitionTextView does not trigger when tapped. What can I do to fix this…
2
votes
0 answers

Detecting paste UITextView in textViewDidChange

I am creating a UITextView for use as a rudimentary IDE. When the user pastes text (code) I am modifying it so that it fits inline (correctly indented) with the other text. However, I am also coloring the text (attributedText) using the…
Anters Bear
  • 1,816
  • 1
  • 15
  • 41