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
20
votes
6 answers

UI test fails when it types text into a text view when run by an Xcode bot

I have the following XCTest UI test that types text into a text view. let textView = app.textViews.elementBoundByIndex(0) textView.tap() textView.typeText("Hello world") When run as an Xcode bot it shows the following error for the typeText…
Evgenii
  • 36,389
  • 27
  • 134
  • 170
20
votes
2 answers

Error on TextView with detection phone number IOS 9

I'm testing my app on an iPod Touch running iOS 9 (on iOS 8.4 it was working for other functions: FaceTime, copy to contacts, etc.). I have a textview with phone number detection and I receive the following error: Warning: Attempt to present…
Anibal Lamego
  • 241
  • 1
  • 8
20
votes
2 answers

ios - iOS 7 UITextView is slow after typing lots of text

I'm having trouble with a slowdown that occurs in UITextView on iOS 7 when typing lots of text. I put a tracer in NSLayoutManager and identified that drawGlyphsForGlyphRange runs N*2 times, where N is the number of times your lines…
philipkd
  • 910
  • 7
  • 20
20
votes
8 answers

iOS7 TextKit: bullet point alignment

I'm writing an app for iOS 7 only and I'm trying to get decent formatting on bullet points in a non-editable UITextView. It's easy enough to just insert a bullet point character, but of course the left indentation won't follow. What's the easiest…
Frank R.
  • 2,328
  • 1
  • 24
  • 44
20
votes
2 answers

UITextView keyboardDismissMode Bug

I've just found an annoying bug with the new keyboardDismissMode property of the scroll view. When using this with a text view with the value UIScrollViewKeyboardDismissModeInteractive and the keyboard is dismissed the scroll view seems to jump up…
Dino
  • 566
  • 1
  • 7
  • 19
20
votes
3 answers

How to make a UITextView call the addTarget method

How will I use the method addTarget with a UITextView? I know that you can use it with a UITextField, but I can't use it with a UITextView. I can't even create an action with a UITextView. Is there any way to do this? Thanks in advance.
user2273191
19
votes
13 answers

Stop UITextView from jumping when programmatically setting text

I have to update a small amount of text in a scrolling UITextView. I'll only be inserting a character where the cursor currently is, and I'll be doing this on a press of a button on my navigation bar. My problem is that whenever I call the setText…
Michael Waterfall
  • 20,497
  • 27
  • 111
  • 168
19
votes
2 answers

Applying transform to UITextView - prevent content resizing

When I apply a rotation transform to a UITextView and then click inside to begin editing, it appears that the content size is automatically being made wider. The new width of the content view is the width of the rotated view's bounding box. For…
Stuart
  • 36,683
  • 19
  • 101
  • 139
19
votes
1 answer

UITextView doesn't show InputAccessoryView on first click

I use the UITextViewDelegate and add a InputAccessoryView in textViewDidBeginEditing: [textView setInputAccessoryView:doneBar]; The doneBar is not nil and it appears on second opening. Has anyone else this problem? Thanks in advance.
Fabio Poloni
  • 8,219
  • 5
  • 44
  • 74
19
votes
2 answers

How to get height of a line in UITextView

As shown in above diagram ... the lineHeight is the height of the orange box. How can I get the height of the blue box (i.e. lineHeight + line spacing height)? Thanks! UPDATE: I found the the lineHeight behaves differently depends on the…
ohho
  • 50,879
  • 75
  • 256
  • 383
19
votes
3 answers

iOS 11 - disable smart quotes

iOS 11 adds smart quotes when typing. In macOS we can disable smart quotes on a NSTextView by setting: textView.automaticQuoteSubstitutionEnabled = NO; Neither UITextField or UITextView seem to have this property or the enabledTextCheckingTypes…
Kyle
  • 17,317
  • 32
  • 140
  • 246
19
votes
3 answers

UITextview inside UIStackView

I added my UITextView inside UIStackView. But my textview is not Multiline. Auto layout is shown as below: As per Image it is just taken 1 line. The textview frame shown as out of frame as per image. UITextView UIStackView
user2526811
  • 1,233
  • 4
  • 20
  • 54
19
votes
3 answers

How to display clickable links in UITextView

I am trying to display an attributed string in a UITextview with clickable links. I've created a simple test project to see where I'm going wrong and still can't figure it out. I've tried enabling user interaction and setting the…
jhk727
  • 225
  • 1
  • 2
  • 8
19
votes
2 answers

Localization of iOS Storyboard: UITextView texts are not localized?

I have a storyboard based application, which is localized from German to English. Most strings in the UI are correctly pulled from the Main.strings files, with the exception of all text in UITextViews, although they do appear in Main.strings…
mrd
  • 4,561
  • 10
  • 54
  • 92
19
votes
3 answers

UITextView with voiceover

Here is my very simple code for creating a UITextView. UITextView *textView = [[UITextView alloc] initWithFrame:self.view.bounds]; textView.editable = NO; textView.text = @"Using iOS 3.0 and later, VoiceOver is available to help users with visual…
dariaa
  • 6,285
  • 4
  • 42
  • 58