`UITextRange` objects represent a range of characters in a text container in Apple's `UIKit` framework, such as `UITextField` or `UITextView`.
Questions tagged [uitextrange]
20 questions
0
votes
1 answer
Why is characterRange(at: .zero) == nil?
I have a UITextView with some text that exceeds its bounds. Thus, vertical scrolling is enabled.
Now I want to find the position of the first visible character. This is what I tried:
let firstCharacterPosition = characterRange(at:…

Mischa
- 15,816
- 8
- 59
- 117
0
votes
1 answer
UITextView get previous character - (i.e character before the cursor position) (iOS7)
I can't work out how I can get the previous character that was entered. so in other words how can I get the character that is just before the cursor any where inside the UITextView.
NSInteger pos = [self.textInput…

Wael
- 489
- 6
- 19
0
votes
1 answer
Observing caret movement in Objective C
I've been trying to write a method that would observe the caret and auto-scroll to a line where caret is. I managed to scroll whenever user types in something but when it comes to observing the caret with key-value observing like…

ozlem_muslu
- 11
- 2
0
votes
2 answers
Getting Remaining Text After Selection is Cut
Is there a simple way of getting remaining text after selection is cut? Let me suppose that I have a textview control with "Hello, Jim" in it. If "Jim" is selected, I want to store "Hello" to a variable, " without using [textview1 cut:self]. In…

El Tomato
- 6,479
- 6
- 46
- 75
0
votes
1 answer
Insert space in current cursor location
I've searched stackoverflow and the web, but couldn't find something that works. I have a UIButton that inserts a space when you click on it, now it adds the space at the end of the UITextField even when the cursor is in the middle.
How can I add…

ytpm
- 4,962
- 6
- 56
- 113