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
8
votes
2 answers

How to trigger textViewdelegate on programmatical UITextView edits

If I am typing with the keyboard, then textViewDidChange and shouldChangeTextInRange are always called. But when I change the textView programmatically, the delegate methods aren't called. How do I get a programmatic change in textView to trigger…
Katedral Pillon
  • 14,534
  • 25
  • 99
  • 199
7
votes
1 answer

textViewDidChange: crashes in iOS 7

As we know the UITextView is more powerful in iOS 7, but here it performs more fragile. The following code works fine when inputting "rr" with Chinese input keyboard in iOS 6, but crashes in iOS 7. - (void)viewDidLoad { [super viewDidLoad]; …
lu yuan
  • 7,207
  • 9
  • 44
  • 78
6
votes
2 answers

iOS15 UITextView After dragging the view, it causes a crash, Invalid parameter not satisfying: pos

crash example The above article is a problem found by a netizen on the forum. Recently, I also found a similar crash stack on firebase. I guess it is also caused by this reason, and it may be the problem of data out of bounds. Do you have a good…
Jersey
  • 391
  • 1
  • 4
  • 14
6
votes
2 answers

How to detect deletion of image in UITextView

If I add an image into a UITextView like this: NSTextAttachment *textAttachment = [[NSTextAttachment alloc] init]; textAttachment.image = image; NSAttributedString *attrStringWithImage = [NSAttributedString…
soleil
  • 12,133
  • 33
  • 112
  • 183
6
votes
1 answer

Handle marked text on iOS keyboard

According to the doc, Marked text, which is part of multistage text input, represents provisionally inserted text that the user has yet to confirm. It is styled in a distinctive way. The range of marked text always contains within it a range…
Jason Lee
  • 3,200
  • 1
  • 34
  • 71
6
votes
3 answers

textViewDidEndEditing is not called

I'm new to iOS development. I have written header file following like this @interface TextView : UITextView in TextView.h. The implementation file code is following : -…
Kirubachari
  • 688
  • 11
  • 27
6
votes
8 answers

UITextView not becoming first responder

I have a UIView that contains a UITextView. The UIView is initiated inside a UIViewController. But when I touch the UITextView box, nothing happens. Neither the keyboard appears nor delegate methods respond to interaction. Code: noteText =…
lagos
  • 1,968
  • 3
  • 17
  • 26
6
votes
2 answers

UITextView attributedText and syntax highlighting

Background So, with iOS 6 an UITextView can take an attributedString, which could be useful for Syntax highlighting. I'm doing some regex patterns in -textView:shouldChangeTextInRange:replacementText: and oftentimes I need to change the color of a…
5
votes
1 answer

UITextViewDelegate behaviour when backspace key is HELD Down

I've run into a problem where iOS is giving my UITextViewDelegate incorrect information when the delete key is held on the keyboard. When the user HOLDS the delete key on a UITextView on an iPad the UITextView will begin to delete entire words…
simeon
  • 4,466
  • 2
  • 38
  • 42
5
votes
2 answers

UITextView scrolling up after deleting/inserting text

I have been re-writing my app for iOS 7. It now uses the new TextKit API. I'm nearly complete but there is one more issue that has been causing me headache since I've started doing the transition. Problem: When I enter text in the UITextView, on…
PeqNP
  • 1,363
  • 15
  • 26
5
votes
2 answers

Initializing NSAttributedString with HTML file parses HTTP links as file URLs

iOS 7 allows an NSAttributedString to be initialized with an HTML file or data. I want to use this functionality to make it easier to insert links in 'About' texts of apps. To achieve this, I initialize the NSAttributedString with the following…
SpacyRicochet
  • 2,269
  • 2
  • 24
  • 39
5
votes
1 answer

textViewDidChange is not call when change UITextView.inputView?

I drag a UITextView and hook up delegate with File's Owner. The textViewDidChange is called only with default keyboard, but nothing happen when input text from my keyboard. How to enable delegate of UITextView when set its inputView to a custom…
strong
  • 111
  • 1
  • 6
5
votes
2 answers

textViewShouldBeginEditing not called when not editable become to editable

I encountered a problem on the UITextFieldDelegate, anyone can help me will be great appreciate. There is a UITextView, and I implemented its delegate. Normally all delegate methods called very good. But in this case: set the UITextView not…
Albert Zhang
  • 757
  • 1
  • 8
  • 19
4
votes
2 answers

UITextView delegate calling multiple times

I am using UITextView and implemented the delegate function var count = 0 func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { print(text) count += 1 print(count) return…
Suresh
  • 1,199
  • 2
  • 12
  • 36
4
votes
0 answers

UITextView Delegate is not firing shouldChangeTextInrange delegate method

I have a UITextView connected from Storyboard, call it txtView. In my ViewController I set the delegate like txtView.delegate = self. The view controller fires method like textViewDidBeginEditing and textViewDidChange, but not func textView(_…
7ball
  • 2,183
  • 4
  • 26
  • 61
1
2
3
14 15