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
17
votes
1 answer

Animated UIImage in UITextView with TextKit

I have a UIImage that contains multiple image frames and a duration which was sliced together from an animated GIF file. If I load the image in a UIWebView it will animate as expected, but I want to use a UITextView instead. The obvious choice is to…
afrederick
  • 1,388
  • 1
  • 10
  • 24
17
votes
3 answers

How to Get NSAttributedString from CGSIZE for UITextView?

I am creating a reader app using UITextView and NSAttributedString, I need to split whole attributedString into smaller amount of attributed string to enable Pages Concept. I have method for calculating frame size of given attributed string. …
Manimaran
  • 465
  • 2
  • 10
17
votes
5 answers

iOS 7 - UITextView size font to fit all text into view (no scroll)

I am trying to find a non-deprecated method to size the font of a textview down so that all text fits in the textview without requiring scrolling. The method 'sizeWithFont' is deprecated and I want to ensure best practices, and XCode says to use…
JimmyJammed
  • 9,598
  • 19
  • 79
  • 146
17
votes
2 answers

Center the text in a UITextView, vertically and horizontally

I have a grouped table view with one cell. In this cell I'm putting a UITextView in cellForRowAtIndexPath:, and I instantly make this first Responder. My problem is: When I start typing, the text is left-justified, not centered horizontally and…
user3083408
  • 335
  • 1
  • 4
  • 11
17
votes
8 answers

Detect moment when newline starts in UITextView

I try to detect when carriage goes at new line in UITextView. I can detect it by comparison total later width with UITextView width: CGSize size = [textView.text sizeWithAttributes:textView.typingAttributes]; if(size.width >…
mriddi
  • 423
  • 2
  • 4
  • 11
17
votes
4 answers

Replace UITextViews text with attributed string

I have a UITextView and when the user is entering text into it, I want to format the text on the fly. Something like syntax highlighting... For that I'd like to use UITextView... Everything works fine expect one problem: I take the text from the…
Georg
  • 3,664
  • 3
  • 34
  • 75
17
votes
2 answers

NSAttributedString '\n' ignored

I have a single view whose only UI element is a UITextView. In viewDidLoad: I create an attributed string with "Text\n" and set the text view's attributed text as such: NSAttributedString *string = [[NSAttributedString alloc]…
winsome
  • 173
  • 1
  • 6
17
votes
4 answers

UITextView subclass as delegate of itself

Let's say I add a UITextView to my UIView, and I want it to change its background color each time the contents change. I can do this by becoming the delegate of the UITextView and implementing textViewDidChange. If I am using this behavior…
Ben Packard
  • 26,102
  • 25
  • 102
  • 183
16
votes
4 answers

how to insert text at any cursor position in uitextview?

i want to implement Code by which i can start to insert text at any position of cursor in UITextView in iphone sdk any idea? thank you in advance.. i refereed this link: iPhone SDK: How to create a UITextView that inserts text where you tap? But…
kushalrshah
  • 638
  • 1
  • 5
  • 14
16
votes
3 answers

UITextView word wrap breaks in the middle of a word

I'm using a UITextView to present definitions which may be one or more lines long. When it does go past a lane, if often wraps in the middle of a word. Is this normal? What can be done to prevent this?
Jack BeNimble
  • 35,733
  • 41
  • 130
  • 213
16
votes
10 answers

How to resize UITextView on iOS when a keyboard appears?

There's UITextView inserted into tab in UITabBarController (on the iPhone). Fill UITextView with a lot of lines. Show a keyboard to edit text. What's happen? The keyboard hide a half of UITextView with cursor. Can't edit the text as the…
Dmitry
  • 14,306
  • 23
  • 105
  • 189
16
votes
1 answer

How to add placeHolder Text in UItextView? in iphone sdk

Possible Duplicate: Placeholder in UITextView In iPhone App How to add placeHolder Text (to hold some default text) in UItextView?
ios
  • 6,134
  • 20
  • 71
  • 103
16
votes
1 answer

UITextView – can't set underline or strikethrough attributes on text?

I'm getting runtime failures whenever I try to set underline or strikethrough attributes on the attributedText of a UITextView. Other properties, like font and background color have no problems. Here's a code snippet. All I have is a test project…
Adam Bryant
  • 545
  • 3
  • 13
16
votes
1 answer

How to make a vertical UITextView by subclassing it from UIScrollView in Swift?

Background I'm new to iOS development, but in order start making even the most rudimentary apps using the vertical Mongolian script, I need to have a vertical UITextView. I haven't found any other Mongolian app developers sharing their code so I am…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
16
votes
3 answers

How to Render large size documents in iOS?

I am working on a Reader Project, currently I am parsing the XML file and converted as an attributed string and I render it in CoreText (Used apple Sample Code). The XML file size is above 6 MB. The texts are rendered correctly, but I can't render…
Manimaran
  • 465
  • 2
  • 10