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.
uitextview
5,819
questions
754
votes
63
answers
392k
views
Placeholder in UITextView
My application uses an UITextView. Now I want the UITextView to have a placeholder similar to the one you can set for an UITextField.
How to do this?
570
votes
24
answers
234k
views
How to lose margin/padding in UITextView
I have a UITextView in my iOS application, which displays a large amount of text.
I am then paging this text by using the offset margin parameter of the UITextView.
My problem is that the padding of ...
565
votes
41
answers
431k
views
How do I size a UITextView to its content?
Is there a good way to adjust the size of a UITextView to conform to its content? Say for instance I have a UITextView that contains one line of text:
"Hello world"
I then add another line of text:
...
482
votes
26
answers
416k
views
Multiple lines of text in UILabel
Is there a way to have multiple lines of text in UILabel like in the UITextView or should I use the second one instead?
407
votes
47
answers
377k
views
Add placeholder text inside UITextView in Swift?
How can I add a placeholder in a UITextView, similar to the one you can set for UITextField, in Swift?
401
votes
34
answers
326k
views
How to dismiss keyboard for UITextView with return key?
In IB's library, the introduction tells us that when the return key is pressed, the keyboard for UITextView will disappear. But actually the return key can only act as '\n'.
I can add a button and ...
355
votes
15
answers
58k
views
After upgrading to Xcode 11.2 from Xcode 11.1, app crashes due to _UITextLayoutView
After upgrading to Xcode 11.2 from Xcode 11.1 my app crashes:
*** Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named ...
293
votes
11
answers
354k
views
How to create a multiline UITextfield?
I am developing an application where user has to write some information. For this purpose I need a UITextField which is multi-line (in general UITextField is a single line).
As I'm Googling I find a ...
250
votes
16
answers
145k
views
Change UITextField and UITextView Cursor / Caret Color
I'm wondering about changing the color of the cursor / caret in a UITextField (And UITextView if its the same answer) in iOS. I've seen answers for OSX development, but nothing for iOS.
Is this even ...
234
votes
23
answers
287k
views
How can I make a clickable link in an NSAttributedString?
It's trivial to make hyperlinks clickable in a UITextView. You just set the "detect links" checkbox on the view in IB, and it detects HTTP links and turns them into hyperlinks.
However, that still ...
185
votes
17
answers
117k
views
UITextView that expands to text using auto layout
I have a view that is laid out completely using auto layout programmatically. I have a UITextView in the middle of the view with items above and below it. Everything works fine, but I want to be able ...
174
votes
20
answers
143k
views
How to style UITextView to like Rounded Rect text field?
I am using a text view as a comment composer.
In the properties inspector I can't find anything like a border style property so that I can make use a rounded rect, something like UITextField.
So, ...
164
votes
5
answers
144k
views
Getting and Setting Cursor Position of UITextField and UITextView in Swift
I've been experimenting with UITextField and how to work with it's cursor position. I've found a number of relation Objective-C answers, as in
Getting the cursor position of UITextField in ios
...
146
votes
13
answers
28k
views
UITextView style is being reset after setting text property
I have UITextView *_masterText and after call method setText property font is being reset.
It's happening after I change sdk 7.
_masterText is IBOutlet, global and properties are set in storyboard. ...
145
votes
19
answers
145k
views
How can I change the color of a part of a TextView?
text = text + CepVizyon.getPhoneCode() + "\n\n"
+ getText(R.string.currentversion) + CepVizyon.getLicenseText();
activationText.setText(text);
myTextView.setText(text);
I ...
132
votes
11
answers
61k
views
Can I change the color of auto detected links on UITextView?
I had a UITextView that detects phone numbers and links, but this overrides my fontColor and change it to blueColor. Is there a way to format the color of auto detected links, or should I try a manual ...
129
votes
12
answers
77k
views
Detecting taps on attributed text in a UITextView in iOS
I have a UITextView which displays an NSAttributedString. This string contains words that I'd like to make tappable, such that when they are tapped I get called back so that I can perform an action. I ...
120
votes
16
answers
168k
views
Swift: Display HTML data in a label or textView [duplicate]
I have some HTML data, which contains headings, paragraphs , images and lists tags.
Is there a way to display this data in one UITextView or UILabel?
114
votes
23
answers
166k
views
how to make UITextView height dynamic according to text length?
As you can see in this image
the UITextView changes it's height according to the text length, I want to make it adjust it's height according to the text length.
*I saw other questions, but solutions ...
114
votes
33
answers
109k
views
How disable Copy, Cut, Select, Select All in UITextView
The UITextView's Copy, Cut, Select, Select All functionality is shown by default when I press down on the screen. But, in my project the UITextField is only read only. I do not require this ...
112
votes
9
answers
77k
views
How to intercept click on link in UITextView?
Is it possible to perform custom action when user touch autodetected phone link in UITextView. Please do not advice to use UIWebView instead.
And please don't just repeat text from apple classes ...
103
votes
37
answers
76k
views
How do I force a UITextView to scroll to the top every time I change the text?
OK, I'm having some problem with the UITextView. Here's the issue:
I add some text to a UITextView. The user then double clicks to select something.
I then change the text in the UITextView (...
94
votes
6
answers
49k
views
IOS - remove ALL padding from UITextView
There are many great examples on SO to remove the left padding of a UITextView.
How to lose margin/padding in UITextView?
However, I need to remove the right padding too.
I have tried...
[tv ...
89
votes
11
answers
138k
views
Display html text in uitextview
How can I display HTML text in textview?
For example,
string <h1>Krupal testing <span style="font-weight:
bold;">Customer WYWO</span></h1>
...
87
votes
18
answers
83k
views
Limit number of characters in uitextview
I am giving a text view to tweet some string .
I am applying the following method to restrict the number of characters to 140 in length.
- (BOOL)textView:(UITextView *)textView ...
83
votes
11
answers
99k
views
Limit the number of lines for UITextview
I was wondering how to limit the amount of LINES (not characters as asked in other questions) a user can enter when editing a UITextField.
Ideally, I would like to limit the input to max. 10 lines.
...
79
votes
22
answers
38k
views
UITextView text content doesn't start from the top
I have a long text coming from my JSON file but when I click the link from my UITableViewCell to go to my UIViewController page, the UITextView text loads the string content but it does not show the ...
78
votes
9
answers
65k
views
iOS7 UITextView contentsize.height alternative
I'm porting one of apps from iOS 6.1 to iOS 7. I'm using a layout where there's a UITextView that has a fix width, but it's height is based on its contentsize. For iOS 6.1 checking the contentsize....
75
votes
19
answers
77k
views
Center text vertically in a UITextView
I want to center the text vertically inside a big UITextView that fills the whole screen - so that when there's little of text, say a couple of words, it is centered by height.
It's not a question ...
74
votes
11
answers
37k
views
Cursor not showing up in UITextView
Can anyone think of a reason that the blinking cursor would not show up in a UITextView? I have a custom control that is just a subclass of UIView and it has a UITextView in it, but the cursor doesn't ...
73
votes
24
answers
32k
views
UITextView: Disable selection, allow links
I have a UITextView which displays an NSAttributedString. The textView's editable and selectable properties are both set to false.
The attributedString contains a URL and I'd like to allow tapping ...
69
votes
6
answers
78k
views
dismiss keyboard with a UITextView
I am sure this is not that difficult, but I am having trouble finding info on how to dismiss a keyboard with the return/done key using a textview, not a textfield. here is what I have tried so far(...
68
votes
12
answers
107k
views
Adding a line break to a UITextView
I have a UITextView that takes an NSString with formatting stringWithUTF8String. It is getting its values from a database and I want the text in the database to be rendered with breaks within the text....
65
votes
8
answers
62k
views
Add "padding" to a UITextView
as the title says i am trying to add padding-like behavior to a UITextView. The textview is generated when the view is pushed inside my navigation controller and the following code occurs:
self....
65
votes
14
answers
83k
views
How do I size a UITextView to its content on iOS 7?
I've been using the accepted answer here for years.
On iOS 7, the contentSize.height becomes the frame.height-8, regardless of text content.
What's a working method to adjust the height on iOS 7?
64
votes
6
answers
38k
views
How to make a new line in UITextView in nib/storyboard?
I am trying to make a new line in Xcode 4.2 UITextView, and when I do alt+return, it goes to the next line, but does not show up when built and ran.
63
votes
8
answers
73k
views
How to make UITextView detect links for website, mail and phone number
I have a UITextView object. The text in UIView has a phone number, mail link, a website link. I want to show them as links with following functionality.
When someone taps on URL - Safari should open ...
59
votes
17
answers
53k
views
UITextView link detection in iOS 7
I have a UITextView which is managed via Interface Builder. As data detection I have "Links" checked. In iOS 6 everything is working fine and links are highlighted and are clickable. In iOS 7 though, ...
59
votes
4
answers
58k
views
How to dynamically resize UITableViewCell height
I have the classical grouped UITableView with editable UITextViews inside every cell. This text views can be single or multi-lined, and I want the cell to increase its height as the user writes and ...
58
votes
9
answers
55k
views
How to set margins (padding) in UITextView?
I have a UITextView for text editing. By default, it has a small margin around the text. I want to increase that margin by a few pixels.
The contentInset property gives me margins, but it does not ...
57
votes
17
answers
31k
views
Large Text Being Cut Off in UITextView That is Inside UIScrollView
I'm having a serious problem that I just can't seem to fix and it's driving me insane for the last two days. I have searched far and wide and I can't find a solution, even though I have tried many.
...
56
votes
7
answers
35k
views
Create UITextRange from NSRange
I need to find the pixel-frame for different ranges in a textview. I'm using the - (CGRect)firstRectForRange:(UITextRange *)range; to do it. However I can't find out how to actually create a ...
55
votes
10
answers
94k
views
UILabel auto resize on basis of text to be shown
I'm working on an application, in which I'm required to autoresize the text area on basis of text to be displayed.
Firstly, I'm not sure for this either I should use UILabel (Logically is the best ...
55
votes
8
answers
49k
views
How to set the border of UITextView to same as border color of UITextField
By default UITextField has a light gray color as its border color.
I want to set my UITextView to have the same border color as the UITextField.
I tried:
myTextView.layer.borderColor = UIColor....
54
votes
11
answers
16k
views
UITextView in iOS7 clips the last line of text string
UITextView in iOS7 has been really weird. As you type and are entering the last line of your UITextView, the scroll view doesn't scroll to the bottom like it should and it causes the text to be "...
52
votes
6
answers
99k
views
How to insert placeholder in UITextView? [duplicate]
Is there any way to insert a placeholder in a UITextView similar to the UITextField? If yes, then please send me any link or any idea to implement this functionality.
51
votes
13
answers
20k
views
UITextView is not scrolled to top when loaded
When I have text that does not fill the UITextView, it is scrolled to the top working as intended. When there is more text than will fit on screen, the UITextView is scrolled to the middle of the text,...
49
votes
12
answers
40k
views
UITextView text not starting from top
I have a UITextView. I want its text to start from top but I it is not coming from top. Please have a look at my code :
UITextView *myTextView = [[UITextView alloc] init];
myTextView.frame = rect;
...
49
votes
2
answers
2k
views
UITextView renders custom font incorrectly in iOS 7
My app uses a UITextView to input Syriac text (Estrangelo font), but UITextView renders some letters incorrectly like this:
I tested it with a UILabel and a UITextView. UILabel displays it correctly, ...
48
votes
7
answers
23k
views
How to apply text shadow to UITextView?
Actually I love UILabel. They're sweet. Now I had to go to UITextView because UILabel is not aligning text vertically to the top. Damn. One thing I really need is a text shadow. UILabel has it. ...