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

UITextView doesn't update its contentSize

I'm dynamically sizing a UITextView's height and the height of the UITableViewCell it is embedded in when its content changes. But I also have the ability to paste in predefined bits of texts. As this pasting happens programmatically, the problem…
dkaisers
  • 824
  • 1
  • 8
  • 15
13
votes
3 answers

CGRect for selected UITextRange adjustment for multiline text?

I've used this answer in order to create a CGRect for a certain range of text. In this UITextView I've set it's attributedText (so I've got a bunch of styled text with varying glyph sizes). This works great for the first line of text that's left…
brandonscript
  • 68,675
  • 32
  • 163
  • 220
13
votes
6 answers

UITextField text disappears on every other keystroke

Here is a video of the phenomena: http://youtu.be/c0TP8YVF9TE As the video shows, the value in exampleTextView.text is not lost. Its just hidden every other keystroke. Solutions tried: I do not set the exampleTextView.text value to something…
Andrew Schreiber
  • 14,344
  • 6
  • 46
  • 53
13
votes
3 answers

How can I support the up and down arrow keys with a Bluetooth keyboard under iOS 7

Under iOS 6, up and down arrow keys were respected by UITextView when using an external Bluetooth keyboard and when working in the simulator. Under iOS 7 the up and down arrow keys no longer do anything, although the left and right arrow keys still…
Mike
  • 3,084
  • 1
  • 25
  • 44
13
votes
4 answers

UITextView selectedRange not displaying when set programmatically

My problem is that programmatically setting the selectedRange of UITextView selects the text, but does not visually indicate it's selected. Does this sound like a bug in OS 3.0/3.1. More importantly, any solution or suggestions for getting the…
wkw
  • 3,865
  • 3
  • 25
  • 24
13
votes
4 answers

How to get a selected range of text from a UITextView or UITextField

I am trying to get the selected range of text from a UITextView (and or UITextField) so that I can edit the selected text, or modify an attributed string. The method below is triggered when I make a selection, but the code in the method returns null…
OWolf
  • 5,012
  • 15
  • 58
  • 93
13
votes
8 answers

increase uitableviewcell height simultaneously increasing the inner UITextView

I create a UITableView with different types of UITableViewCell depending on the type of content to display. One of this is a UITableViewCell with inside an UITextView programmatically created in this way: - (UITableViewCell *)tableView:(UITableView…
LuckyStarr
  • 1,468
  • 2
  • 26
  • 39
13
votes
5 answers

Is there any way to show the scroll indicator of a UITextView without starting to scroll?

I have a UITextView with text that needs to be scrolled to see the complete text. But there are paragraphs between the text blocks and it is not really obvious that the text is scrollable without starting to scroll so that the scroll indicator…
user387184
  • 10,953
  • 12
  • 77
  • 147
13
votes
9 answers

UITextView: How to really disable editing?

I am trying to disable editing on my UITextView. I have tried [aboutStable setUserInteractionEnabled: NO], but it causes the page to not be accessible. Here is the current code. - (void)loadTextView1 { UITextView *textView1 = [[UITextView alloc]…
user1277610
12
votes
6 answers

Adding left margin to UITextView

I'm trying to add a left margin to a UITextView. I've tried setting the property contentInset, see below: UITextView *textView = [[UITextView alloc] initWithFrame: CGRectMake(0, 0, self.view.bounds.size.width,…
Camsoft
  • 11,718
  • 19
  • 83
  • 120
12
votes
2 answers

UITextView resign first responder on 'Done'

I have been searching around the web for about an hour now, and cannot find any code to help me with this. I have a UITextView that I need to resign first responder of when the user presses the 'Done' button on their keyboard. I have seen code…
Richard J. Ross III
  • 55,009
  • 24
  • 135
  • 201
12
votes
4 answers

Following cursor in dynamic UITextView with UITableView no longer working in iOS 11

I created a UITextView which is sized dynamically within a UITableViewCell as a person types. On iOS 10 the UITextView's cursor is followed automatically with very little code needed. In the UITextViewDelegate method textViewDidChange: I've used…
Mark Reid
  • 2,611
  • 3
  • 23
  • 45
12
votes
3 answers

How do I add a custom action to the text selection edit menu in iOS?

I need to add a custom action to the edit menu that pops up when a user selects some text in a UITextView in iOS. How do I do this?
TomLisankie
  • 3,785
  • 7
  • 28
  • 32
12
votes
4 answers

load rtf file into UITextView in Swift 2

Can somebody help me to load an rtf text into UITextView with Swift 2? The answers I've gotten are old and out of date. The text is instructions on how to play the game I'm writing in an app. So far, all I've been able to do is to copy and paste all…
Edward_JS
  • 149
  • 1
  • 6
12
votes
8 answers

how to give a line below the Textview in android

I want to add uderline which cover the fill parent width below the textview to show the textview look like the heading.
user5533329