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

How to stop UITextView from scrolling up when entering it

I have a UITextView included in a UITableViewCell. The layout is correct when the views are initially displayed, but once I click in the UITextView it automatically scrolls up a bit and the top half of the characters on the first line becomes…
Gero
  • 2,967
  • 6
  • 22
  • 20
29
votes
5 answers

How to know when UITextView became first responder

How to handle when uitextview became first responder. I have text in text view and I want when the view became active want to clear the text. How can I do that? Thanks in advance
nyanev
  • 11,299
  • 6
  • 47
  • 76
29
votes
3 answers

UITableViewCell, UITextView with dynamic height

I need to make a UITableViewCell that holds alot of text. I know I can add a UITextView to my cell, but each entry will not have the same amount of text. I know I can control the height of the UITableViewCell with: -(CGFloat)tableView:(UITableView…
WrightsCS
  • 50,551
  • 22
  • 134
  • 186
28
votes
5 answers

How to make UITextView not editable and dont want keyboard to showup

In a UITextView have a text which is for readonly and dont want any userinteraction at all means dont want text to be edited and even dont want keyboard to showup. I want to make UITextView scrollable. Right now what happening is that it is not…
user1120133
  • 3,244
  • 3
  • 48
  • 90
28
votes
10 answers

Resizing UITextView

I have a UITextView added on my UIView. The textview added is not editable, it is just to display some data. The data displayed in the textview is dynamic. Thats is the number of lines is not fixed. It may vary. So if the number of line increases,…
saikamesh
  • 4,569
  • 11
  • 53
  • 93
28
votes
12 answers

How to do a live UITextField count while typing (Swift)?

I would like to count the character when user keep typing in UITextField with swift. Image of Field and Label: I have already placed UITextField and UILabel, just haven't found any information on Stack overflow, also if you can do one in UITextView…
Brian Nezhad
  • 6,148
  • 9
  • 44
  • 69
28
votes
3 answers

iOS UI best practice - UILabel or UITextView?

If you are creating an UIView for an iPhone application to display an article from a blog, for example. What UI component would you recommend to display the article's body? An UILabel with numberOfLines equals to zero or an UITextView with no…
Gustavo Barbosa
  • 1,340
  • 1
  • 17
  • 27
27
votes
2 answers

UITextView ruled line background but wrong line height

I have a UITextView where the user can create notes and save into a plist file. I want to be able to show lines just like a normal notebook. The problem I have is that the text won't align properly. The image below explains the problem quite…
Fernando Redondo
  • 1,557
  • 3
  • 20
  • 38
27
votes
4 answers

Slow load time for custom UIView with UITextView property in Swift

I originally asked this question. I had assumed that the reason for the slow load time of my custom view was because of layering multiple views on top of each other or perhaps because of some recursion problem. However, after cutting out more and…
Suragch
  • 484,302
  • 314
  • 1,365
  • 1,393
27
votes
6 answers

Disable autocorrect UITextView Swift

How can I turn off auto correct and spell check in Swift? I found the following for objective-c, but nothing so simple for swift. myTextView.autocorrectionType = UITextAutocorrectionTypeNo;
SpaceShroomies
  • 1,635
  • 2
  • 17
  • 23
27
votes
8 answers

iOS 7 UITextView vertical alignment

How is that possible that my editable UITextView (placed inside a straightforward UIViewController inside a UISplitView that acts as delegate for the UITextView) is not showing text from the beginning but after something like 6-7 lines? I didn't…
napolux
  • 15,574
  • 9
  • 51
  • 70
26
votes
5 answers

UIView atop the Keyboard similar to iMessage App

currently I'm attempting to basically implement and exact copy of Apples iMessage App. That means I need a UITextView that is docked at the bottom of the screen, and moves up when it becomes firstResponder. - That's pretty easy actually. There's a…
pkluz
  • 4,871
  • 4
  • 26
  • 40
26
votes
9 answers

Making a UITextView not editable by the user

I made this UITextView and everything is perfect except the fact that when the user taps it, the keyboard opens up. How can I disable that "editing(?)" option? Here's the code: - (void)loadAboutStable { UITextView *aboutStable = [[UITextView alloc]…
Peter V
  • 2,478
  • 6
  • 36
  • 54
26
votes
8 answers

UITextView linkTextAttributes font attribute not applied to NSAttributedString

I have an NSAttributedString generated from HTML which includes some links. The attributed string is shown in a UITextView. I wish to apply a different font style for the links and am setting linkTextAttributes for this. I've added…
lostInTransit
  • 70,519
  • 61
  • 198
  • 274
26
votes
6 answers

Pixel-Position of Cursor in UITextView

Is there a way of getting the position (CGPoint) of the cursor (blinking bar) in an UITextView (preferable relative to its content). I don’t mean the location as an NSRange. I need something around: - (CGPoint)cursorPosition; It should be a…
Raphael Schaad
  • 1,659
  • 1
  • 17
  • 17