Questions tagged [uitextview]

The UITextView class implements the behavior for a scrollable, multiline text region in iOS. The class supports the display of text using a custom font, color, and alignment and also supports text editing. You typically use a text view to display multiple lines of text, such as when displaying the body of a large text document.

The UITextView class implements the behavior for a scrollable, multiline text region. The class supports the display of text using custom style information and also supports text editing. You typically use a text view to display multiple lines of text, such as when displaying the body of a large text document.

Before iOS 6 () the text could only be styled as a whole, since then the view supports finer grained control of the text style through the .attributedText property.

References:

UITextView Class Reference

5806 questions
16
votes
4 answers

Add UITapGestureRecognizer to UITextView without blocking textView touches

How can I add a UITapGestureRecognizer to a UITextView but still have the touches getting through to the UITextView as normal? Currently as soon as I add a custom gesture to my textView it blocks the tap for UITextView default actions like…
Bernd
  • 11,133
  • 11
  • 65
  • 98
16
votes
2 answers

How to add CSS for HTML to NSAttributedString?

I am trying to load an HTML file via NSAttributedString to display it in a UITextView. So, how can I apply CSS to the text view's content?
Karan Alangat
  • 2,154
  • 4
  • 25
  • 56
16
votes
6 answers

UITextView contentOffset on iOS 7

I have a UITextView in my app. I need to change it's content offset dynamically every time a new string is appended. The code bellow works fine on iOS 6 and earlier versions, but not on iOS 7. CGPoint offset = CGPointMake(0,…
Mihai
  • 768
  • 2
  • 6
  • 18
16
votes
9 answers

UITextView cursor below frame when changing frame

I have a UIViewCOntrollerthat contains a UITextView. When the keyboard appears I resize it like this: #pragma mark - Responding to keyboard events - (void)keyboardDidShow:(NSNotification *)notification { NSDictionary* info = [notification…
Anders
  • 2,903
  • 7
  • 58
  • 114
15
votes
4 answers

How to detect user input character in UITextView

How to detect user input character in UITextView? For example:(in UITextView NOT UITextField) when user input letter "a", trigger an event. when user input "do it", trigger another event. or input "http://www.stackoverflow.com" trigger an…
Jason Zhao
  • 1,278
  • 4
  • 19
  • 36
15
votes
3 answers

UITextView and position of floating autocorrect window

I have a UITextView with autocorrection on. The view's height is about 30 pix. When autocorrect kicks in the autocorrect view is nearly invisible below the text. Is there a way to control the position of the small autocorrect window or insure it is…
QBit
  • 251
  • 1
  • 8
15
votes
4 answers

Text scrolls outside of the UITextView box boundary

I have a UITextView that has some text in it. The problem is that the text scrolls outside of the boundaries of the UITextView box. (The UITextView is uneditable.) here's the code and what I have tried to resolve this issue: - (void)viewDidLoad…
hanumanDev
  • 6,592
  • 11
  • 82
  • 146
15
votes
2 answers

iOS 13.1 UITextView delegate method shouldInteract called when scrolling on attachment

I'm using the UITextView delegate method to do some custom work like opening a in-app browser when user tapping on URL or attachment: func textView(_ textView: UITextView, shouldInteractWith URL: URL, in…
kukushi
  • 647
  • 9
  • 22
15
votes
1 answer

What NSRange return value do you check for when you call selectedRange on a UITextView that is not currently being edited?

What NSRange return value do you check for when you call selectedRange on a UITextView that is not currently being edited?
MikeN
  • 45,039
  • 49
  • 151
  • 227
15
votes
5 answers

iOS 11: UITextView typingAttributes reset when typing

I use typingAttributes to set a new font. On iOS 10, everything works, but on iOS 11, first typed character is correct, but then attributes are being reset to the previous ones, and the second character is typed with the previous font. Is this a…
Bartosz Bialecki
  • 4,391
  • 10
  • 42
  • 64
15
votes
8 answers

iphone UITextView set line spacing

How can I increase line space in UITextView so that it looks like "Notes" app in iPhone?
Satyam
  • 15,493
  • 31
  • 131
  • 244
15
votes
5 answers

Spacing around NSTextAttachment

How do I make spacing around NSTextAttachments like in the example below? In the example No spacing is the default behaviour I get when I append a NSTextAttachment to a NSAttributedString.
15
votes
3 answers

Changing a UILable to UITextView with out removing and adding from the object library

Is it possible in Xcode to change a UILabel to a UITextView without having to delete the label and then add the textview. I thought maybe you could change the class but it can only find UILabel. Lets say i have added 10 labels, added all the…
Rob85
  • 1,719
  • 1
  • 23
  • 46
15
votes
5 answers

iOS4: Can't Programmatically Scroll to Bottom of UITextView

Before I was using this method.... //TextView is a UITextView [TextView scrollRangeToVisible:NSMakeRange([TextView length], 0)]; ...which would programmatically scroll to the end of the UITextView but it doesn't seem to be working in iOS 4.0. Is…
OscarTheGrouch
  • 2,374
  • 4
  • 28
  • 39
15
votes
2 answers

Detecting tap on a UITextView only detects cancellations

I have been struggling to detect a tap on a UITextView with Swift. My UITextViews are in a table, I must be able to detect links and press them, those links length are unknown. Also if I tap on the cell, that I don't tap on a link, I want push a…
Swift Rabbit
  • 1,370
  • 3
  • 14
  • 29