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
19
votes
3 answers

Get tapped word from UITextView in Swift

I know that this problem has been solved in Objective-C, but I haven't seen any solution to it in Swift. I have tried to convert the solution code from this post, but I'm getting errors: func textTapped(recognizer: UITapGestureRecognizer){ var…
Benjamin Hviid
  • 463
  • 2
  • 5
  • 13
19
votes
7 answers

UITextView's text going beyond bounds

I have a non-scrollable UITextView with it's layoutManager maximumNumberOfLines set to 9, which works fine, but, I cannot seem to find a method in NSLayoutManager that restricts the text to not go beyond the frame of the UITextView. Take for example…
klcjr89
  • 5,862
  • 10
  • 58
  • 91
19
votes
2 answers

UITextField and Keyboard Notifications - strange order

So I've set up a notification for the keyboard appearance event. Now let us consider a UITextView and a UITextField. [[NSNotificationCenter defaultCenter] addObserver:self …
Bourne
  • 10,094
  • 5
  • 24
  • 51
19
votes
1 answer

Change the keyboardAppearence for the whole app

With iOS7, the protocol UITextInputTraits gets new values for the enum UIKeyboardAppearance. In particular I'm interested in changing the keyboardAppearance to UIKeyboardAppearanceDark in order to match the current app dark design. I first looked…
Luca Bernardi
  • 4,191
  • 2
  • 31
  • 39
19
votes
4 answers

Can't type text into UITextField or UITextView in iOS6

In one of my apps, when I try to edit (type some text) UITextField, UITextView or any other 'text-able' UIControl the cursor just blinks but no characters are typed in except BACKSPACE (possible only when I have some initial text in it), RETURN and…
Lukasz
  • 19,816
  • 17
  • 83
  • 139
19
votes
7 answers

Keyboard and cursor show, but I can't type inside UITextFields and UITextViews

On an iPad with iOS 6 GM. I have 6 UITextFields, 3 UITextViews, and a UIButton that triggers a popover/actionsheet. When I select one of the UITextFields or UITextViews, the keyboard pops up and the cursor appears, but I can't enter text. If I press…
RyeMAC3
  • 1,023
  • 1
  • 10
  • 17
18
votes
5 answers

ios - how to find what is the visible range of text in UITextView?

how to find what text is visible in a scrollable, non-ediable UITextView? for example i may need to show next paragraph, then i want to find the current visible text range and use it to calculate the appropriate range and use scrollRangeToVisible:…
Bryan Chen
  • 45,816
  • 18
  • 112
  • 143
18
votes
2 answers

Get X and Y coordinates of a word in UITextView

I asked a developer (TwoLivesLeft, the creators of Codea) how they did syntax highlighting in their app. He replied : @TD2 the Codea editor is implemented using a UITextView. The highlighting is done by overlaying subviews in the appropriate …
Allison
  • 2,213
  • 4
  • 32
  • 56
17
votes
5 answers

How to toggle autocorrectionType on and off for an existing UITextView

I have a UITextView in my iPhone app for which I want to be able to toggle the autocorrectionType. When a user is editing the text view, I want the autocorrectionType to be set to UIAutocorrectionTypeYes. When the text view is not being edited, I…
adriaan
  • 1,574
  • 14
  • 33
17
votes
3 answers

Add a button to hide keyboard

On a UITextView to hide the keyboard, there is the method: ... textfield.returnKeyType = UIReturnKeyDone; textfield.delegate = self; .... -(BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; …
Vins
  • 1,814
  • 4
  • 24
  • 40
17
votes
5 answers

How do I create a transparent UITextField?

On my 1) UIView one (2) UIImageView will be on this (3) UITextView. This UITextView must be Transparent and we have to view the imageView. How can I do this?
good guy
  • 569
  • 5
  • 11
  • 25
17
votes
4 answers

iOS -- UITextView disable scrolling but enable touches

Is there any way to do this? What I really want is a UITextField where I can control the location of the cursor. But as far as I can tell, that is impossible. So I am looking at using a UITextView. This does allow one to control the cursor…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
17
votes
2 answers

CoreData Edit/Overwrite Object

I am playing around with a new project, a split view iPad app using Core Data, and I was wondering, as its fairly clear how to add and remove an item. If I was to say alter this to hold text, then that text be shown in a UITextView, how can I edit…
Josh Kahane
  • 16,765
  • 45
  • 140
  • 253
17
votes
2 answers

UITextView in a UITableViewCell smooth auto-resize shows and hides keyboard on iPad, but works on iPhone

I have implemented a custom UITableViewCell which includes a UITextView that auto-resizes as the user types, similar to the "Notes" field in the Contacts app. It is working properly on my iPhone, but when I am testing it in the iPad, I am getting…
Jason
  • 14,517
  • 25
  • 92
  • 153
17
votes
1 answer

How to add ellipses on a UITextView?

I need to restrict number of lines in a UITextView to 2 and add ellipses to any overflowing text. How would I do that? For some implementation reasons I cannot use UILabel.
Suchi
  • 9,989
  • 23
  • 68
  • 112