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
5 answers

Strange behaviour with NSLog

I'm using NSLog to inspect a UITextView. I have the following logging statements in my code: NSLog(@"textView: %@",textView); NSLog(@"textView.frame: %@",textView.frame); NSLog(@"[textView frame]: %@",[textView frame]); And in the…
Chris
  • 39,719
  • 45
  • 189
  • 235
13
votes
1 answer

how do I detect and make clickable links in a UILabel NOT using UITextView

I am building a chat app and for performance reasons I need to use UILabel's instead of UITextView's to display the chat messages. I have previously used TextView's but with data detection on the scrolling is very slow and choppy. The problem is…
alionthego
  • 8,508
  • 9
  • 52
  • 125
13
votes
4 answers

Cursor position in a UITextView

I am looking for a non private way to find the position of the Cursor or Caret (blinking bar) in a UITextView preferably as a CGPoint. There may be a question like this already but it does not provide a definitive way for doing it. And, I do not…
Joshua
  • 15,200
  • 21
  • 100
  • 172
13
votes
2 answers

Interpolating UITextFields with UITextView using Text Kit?

I'm working on a text view that replaces placeholders with UITextFields. I pass it an object (a struct or a dictionary) with text containing multiple instances of a placeholder token. The dictionary also contains an array of fields that we want to…
Moshe
  • 57,511
  • 78
  • 272
  • 425
13
votes
0 answers

Replace NSTextContainer of UITextView when loading from XIB/Storyboard

I've made a custom subclass of NSTextStorage, which processes text as I need it to be processed. To use this on a text view I need to create a NSTextContainer and a NSLayoutManager, and then assign the container to the UITextView. This works…
Dominik Hadl
  • 3,609
  • 3
  • 24
  • 58
13
votes
2 answers

Text in UITextView Auto-Scrolled to Bottom

I have what I believe to be a standard UITextView in a ViewController which has a substantial amount of text in it, enough that not all of it can fit on the screen. What I would like to happen is that when that view is loaded, the user can start…
zeeple
  • 5,509
  • 12
  • 43
  • 71
13
votes
2 answers

UITextview clipping with three dots?

I have a UITextView showing some dynamic content that can vary in size. The textview has no scrolling allowed and its size is independent from the content. Given its auto-layout constraints, the text view has a different horizontal size on iphone5…
MikaelW
  • 1,145
  • 4
  • 11
  • 29
13
votes
4 answers

UITextView with text less than 10 characters hangs iOS 9

Starting from iOS 9 (I used Xcode 7.0 beta 6 (7A192o)), an Objective-C app with UITextView will hang if the text view's text is less than 10 characters. CPU usage goes up to 99-100% and the whole system hangs. How to reproduce: Create a brand new…
mllm
  • 17,068
  • 15
  • 53
  • 64
13
votes
3 answers

How to display HTML text in TextView

I have a string containing HTML. I would like to display the HTML in a TextView control. I found some code and tried it: def = "some html text" definition.attributedText = NSAttributedString( data: def.dataUsingEncoding(NSUnicodeStringEncoding,…
lascoff
  • 1,321
  • 4
  • 17
  • 35
13
votes
1 answer

How do I properly render nested/multiple superscripts in DTCoreText?

I want to have multiple/nested superscipts from HTML to NSAttributedString using DTCoreText. If I take the following HTML: Some text with a superscript Which renders on Stackoverflow correctly as: Some text with a…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
13
votes
2 answers

NSAttributedString justified text (without stretching words)

I'm using justified text for my NSAttributedString in my UITextView: var paragraphStyle = NSMutableParagraphStyle() paragraphStyle.alignment = NSTextAlignment.Justified; normalAttributes.setObject(paragraphStyle, forKey:…
Casey Perkins
  • 1,853
  • 2
  • 23
  • 41
13
votes
1 answer

Siri Dictation Bypasses UITextView:shouldChangeTextInRange Delegate

I use (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *) to perform real-time regex validation on every character input into a UITextView. This works well and even handles pasted text that might…
Sebastian Dwornik
  • 2,526
  • 2
  • 34
  • 57
13
votes
3 answers

Why does shouldChangeTextInRange get called multiple times using predictive input?

The predictive-input of iOS8 calls the following delegate method of UITextView multiple times resulting in the selected word being inserted multiple times into the view. This code works for typing single letters and copy/paste but not when using the…
Wex
  • 4,434
  • 3
  • 33
  • 47
13
votes
1 answer

Adjusting the line spacing of UITextView

How do I adjust the line height (line spacing) of a UITextView? Where do I change / add the code? I'm currently trying to add code to the didFinishLaunchingWithOptions function in the AppDelegate.swift file. Here is my code: func…
Steven Schafer
  • 834
  • 3
  • 10
  • 24
13
votes
2 answers

Designated Initializer of UITextView

When I create a new subclass of UITextView in the Xcode 6 Beta, the following code is automatically provided. import UIKit class TerminalView: UITextView { init(frame: CGRect) { super.init(frame: frame) // Initialization code …
Brian Tracy
  • 6,801
  • 2
  • 33
  • 48