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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
17 views

Error: Invalid numeric value (NaN, or not-a-number) to CoreGraphics API - possibly related to UITextview in SwiftUI

When I hover over text sections in my swiftUI app, which uses UITextView representable, I receive this strange warning in the simulator. On actual devices, this cannot be duplicated. Error: this ...
reza23's user avatar
  • 2,999
0 votes
0 answers
28 views

How can I integrate my own text changes into UITextView's undo manager?

I have an app that uses UITextView for some text editing. I have some custom operations I can do on the text that I want to be able to undo, and I'm representing those operations in a way that plugs ...
Tom Hamming's user avatar
  • 10.5k
0 votes
1 answer
32 views

How can I round the corners of an image attachment displayed in a UITextView using Swift?

I am writing on this forum to receive help, I am writing an app on Swift for iPhone and I have created a textview to present some information to end user BUT I have included a picture as an attachment ...
Hernanccito's user avatar
-1 votes
0 answers
32 views

UITextView not firstReponder force selectedRange to take effect

There are two UITextViews, one at the top which is not editable and another at the bottom which is an input field. How can we make it so that when the bottom input field is the first responder, the ...
Jamie's user avatar
  • 1
0 votes
1 answer
39 views

How to Truncate middle text in UITextView Swift

I have to show 3 text on one UITextView , This can be multiline or single line, in Multiline there is no issue . but when there is single line enabled then text is truncated from end because i'm ...
Dhiru's user avatar
  • 3,010
0 votes
0 answers
15 views

How can I use NSParagraphStyle to create a bulleted list in UITextView?

I'm trying to support bulleted list formatting in a UITextView in my app. I've googled around and found various answers to questions (like here) that suggest using NSParagraphStyle. Right now to make ...
Tom Hamming's user avatar
  • 10.5k
0 votes
0 answers
10 views

Is it possible to change the language displayed on UIResponderStandardEditActions when using UITextView?

I have searched on google and checked many pages, it seems nobody faced such a problem, and I also checked Apple's documents, no topics or properties can be set. The device language is also in Chinese,...
stephen's user avatar
  • 469
0 votes
0 answers
62 views

The problem is that the texts are overlapping in the Text View in swift

I created a text view using Storyboard and customized it with the following code. When I write a long text in the TextView and leave two lines of space, the texts overlap. How can I fix this? When I ...
Miaperolla's user avatar
1 vote
2 answers
55 views

How to position the cursor at the beginning of the placeholder text in UITextview

I spent a lot of time trying to fix this simple issues but don't managed it. I want in UITextView to use a placeholder: "translation" and when tapping the UITextView the placeholder should ...
Dude1313's user avatar
0 votes
0 answers
46 views

How to make a textField as firstResponder in Swift iOS - UIKit

In a ViewController and have an UITextView and UITextField. I have selected a range of texts in a textView. So the textView has a cursor selection. I have to apply some attributes to the selectedRange ...
Harry's user avatar
  • 43
0 votes
1 answer
14 views

How to fix iOS custom shaped text layout incorrect ellipse behavior?

I am learning iOS textkit from official tutorials here: https://developer.apple.com/documentation/uikit/textkit/display_text_with_a_custom_layout After running and testing the code for a while, I ...
laishere's user avatar
0 votes
0 answers
40 views

Force UITextView into emoji only mode

I have a UITextView and I want to force the keyboard into an Emoji only state. I would like the user to only have the option to be on the emoji keyboard. I don't want something where the user can ...
driverDran's user avatar
0 votes
0 answers
35 views

Save NSAttributedString as rtfd in iOS

I'm trying to implement a text editor in iOS. It supports basic styles and is able to embed an image. For testing, I created a .rtfd file in Xcode like this: Here is part of my code: // ...
Bagusflyer's user avatar
  • 12.6k
1 vote
0 answers
23 views

Can I access the additional detection in UITextView that is not available in NSDataDetector?

I know the "correct" way to detect text in a string is to use NSDataDetector, but a UITextView can detect more types of data, for example shipment tracking numbers and physical units. Is ...
Gareth Simpson's user avatar
0 votes
0 answers
31 views

In a UITextView the 'accessibilityIgnoresInvertColors' property has the opposite effect

In my UITextView I was trying to troubleshoot the text view inverting colors when the Smart Invert option is switched on by the user (Settings/Accessibility/Display & Text Size/Smart Invert). The ...
Craig Swanson's user avatar
0 votes
0 answers
18 views

How can I make UITextView maintain overall left-to-right text when first character is right-to-left language?

Say I have an app that consists entirely of a view controller with a UITextView. When the text in that text view changes, I save its text to NSUserDefaults. In viewDidLoad, I read the value from ...
Tom Hamming's user avatar
  • 10.5k
-1 votes
1 answer
35 views

How to prevent UITextView from clearing every time when there is a new input?

I am working on a application where I get some data over the network using Mosquito client library and display it on the screen. My problem is that on every new input - say once per second - the old ...
bacata.borisov's user avatar
0 votes
1 answer
124 views

Slow load time with UITextView as compared to UITextField

I am working on a project that creates a form dynamically based on an XML file. Everything works fine, except that if a form has too many textViews, it loads very slowly. Analyzing the app performance ...
Amrit Sidhu's user avatar
  • 1,860
0 votes
0 answers
20 views

draw(rect) of UITextView subclass in a UITableViewCell gives invalid "infinite" rects for selectionRects after scroll

I have the following UITextView subclass: class CustomTextView: UITextView { required init?(coder: NSCoder) { super.init(coder: coder) customInit() } override ...
sudoExclaimationExclaimation's user avatar
0 votes
1 answer
100 views

How to get UITextView number of lines using TextKit 2?

Since iOS 16, TextKit 2 has replaced TextKit 1 for UITextView which means layoutManager is out and textLayoutManager is in. However, a number of the properties from the old are not in the new. How can ...
lurning too koad's user avatar
0 votes
0 answers
25 views

UITextView caretRect giving infinite for minX and maxX?

I'm trying to track where the cursor is in my text view as the user types. It works fine until I get to the second line in the text view and then it's giving me infinite for minX and maxX. Here is the ...
newest_tfriz's user avatar
0 votes
1 answer
21 views

Allow copy and paste in UITextView with character restrictions

I would like to not allow the return button to be pressed on the keyboard while limiting the character count to 200. Problem: When I add restrictions to the UITextView, I cannot copy and paste into ...
adalovelacy's user avatar
0 votes
0 answers
14 views

UITextView inside of UITableViewCell text becomes partially invisible when cell offscreen results in bad snapshots

I have a UITableView with UITextView inside each cell. I need to take a snapshot of a cell in order to implement custom transition (custom context menu for the cell). The issue is characters appears ...
A. Buksha's user avatar
  • 830
1 vote
0 answers
63 views

How to scroll to a part of a UITextView in TextKit 2 - Swift

I was wondering how to scroll to a specific part of a text in UITextView in TextKit2. This approach won't work in long text. I'm trying to use a function like this: private func scroll(in textview: ...
Amirca's user avatar
  • 143
0 votes
0 answers
13 views

Edit the style of the upcoming text in a UITextField [duplicate]

I have a UITextView which has a UITextField inside. When I write in it, I want that if I click on a button the words I will write next will be for example bold. When I then click on the button again, ...
David's user avatar
  • 173
0 votes
2 answers
85 views

Can not show image after attach in UITextView in iOS

I want to insert image to uitextview like note application in iphone. I successfully insert images but when I save the note, I can not show images that I inserted when click to see detail of the note. ...
Cuong Nguyen's user avatar
0 votes
0 answers
92 views

State does not update immediately when Binding is changed in UIViewRepresentable

I want a UITextView with its height wrapped to the content inside. And this solution works just fine. However, it breaks when there are multiple such views, say, in a VStack. In iOS 16 ...
ikroop's user avatar
  • 76
0 votes
1 answer
158 views

Replacing layout manager in UITextView using TextKit 1

I have a UITextView created in storyboard. The view uses TextKit 1, and I'm trying to replace the NSLayoutManager. When calling .sizeThatFits() (or any other method requiring layout) on my text view, ...
Tritonal's user avatar
  • 597
0 votes
1 answer
32 views

Why does the border of UITextView not show when layer.borderColor & layer.borderWidth properties are assigned values saved in variables?

Why is the border of UITextView shows when I set the value of layer.borderColor and layer.borderWidth properties with literals, but does not show when I set the value of those properties with the ...
daniel's user avatar
  • 1,348
1 vote
1 answer
71 views

Can the blank space that is colored when a text with a background in UITextView moves to the next line be prevented?

As seen in the image below, extra spaces occur when the text goes to the bottom line. Can I prevent these from occurring? My code: import UIKit class ViewController: UIViewController { @IBOutlet ...
Zıplayan Penguen's user avatar
0 votes
1 answer
32 views

UITextView scrolling without triggering UIPageViewControllerDataSource in UIPageViewController's view controllers

I have multiple view controllers. Something like this: ViewControllerA ViewControllerB ViewControllerC I use these as my UIPageViewController's view controllers, (as pages). Each one of them has ...
incelemeTRe's user avatar
0 votes
1 answer
48 views

draw lines on all rows of a UITextView

I want to draw a line in UITextView to separate lines like a notebook. After researching, I came across the following site, but the information was out of date and could not be applied to the current ...
Hkr-Y's user avatar
  • 19
0 votes
1 answer
53 views

Change Text When UIImage in a UIImageView Animation Changes

In my app, I need to set up an animation that will run on repeat until I perform an action on it. I want both an image to change, and text change along with it. I am trying now the suggested key frame ...
user717452's user avatar
0 votes
1 answer
75 views

UITextView text disappears after applying transform

I have a simple UITextView with a custom NSLayoutManager in my app. The UITextView have a tap gesture and when you tap on UITextView it animates off the screen. My problem is that when you tap on the ...
FE_Tech's user avatar
  • 1,394
0 votes
0 answers
20 views

How to handle textView, which can be expandable according to the text inside UITableViewCell

This is the textView, I want it to be expandable according the text which is inside UITableViewCell. I have tried to give tableView height, but I am unable to expand UITextView.
Telha Wasim's user avatar
1 vote
0 answers
38 views

UITextView within custom table view cell responds to some messages, not others

I have a custom subclass of UITableViewCell that, in its initializer, loads a nib with itself as the File's Owner, and has outlets to the nib's objects (one of which is a UITextView). But when I set ...
Blaire Crits-Christoph's user avatar
0 votes
0 answers
35 views

Adding regular expression find option to UITextView

I'm trying to implement a regular expression search in a UITextView with the UITextView.findInteraction introduced in iOS 16. The documentation shows a UIFindInteraction.optionsMenuProvider property ...
Nickkk's user avatar
  • 2,177
9 votes
0 answers
185 views

HTML string to NSAttributed string, Bullet point with sub bullet point issue Swift

I am converting an HTML string to an NSAttributedstring to set in TextView, while in text, there are bullet points with sub-bullet points. Bullet points are coming correctly but sub-bullet point ...
MeetMistry15's user avatar
0 votes
0 answers
36 views

UITextView making isScrolledEnabled removes right contentInset

I have a very simple implementation of a UITextView in my app. I have applied contentInset from all four sides, but when I make isScrolledEnabled false right contentInset goes away. With ...
FE_Tech's user avatar
  • 1,394
0 votes
0 answers
52 views

Swift UITextView Delegate

I am having a problem and have searched all across StackO and did not see a solution. I have a UITextview extension with TextViewDelegate that I call inside of my VC so that i can have a placeholder ...
aaron's user avatar
  • 11
0 votes
1 answer
58 views

Selecting text from multiple textViews at the same time

I'm trying to show a long text (like a book) in a screen in iOS. It will be scrolled vertically. And the text should be selectable by the user. I think putting the whole text in a single textView will ...
Ahmed's user avatar
  • 1
1 vote
0 answers
158 views

How to detect the double tap and hold gesture when accessibility is on?

I have an app that displays a link when you scan a QR code. With accessibility turned on (VoiceOver): When I double click on the link I open a custom alert. The problem is that when I double-click and ...
Marcin's user avatar
  • 70
-2 votes
1 answer
27 views

Check If UItextView Text Is Empty Once

I want to call an animation when my UITextView is empty and again when it is not empty. I get the UITextView changes in the delegate method below; func textViewDidChange(_ textView: UITextView) { } ...
David Henry's user avatar
  • 1,834
0 votes
1 answer
50 views

Swift scaleAspectFit an image as a remote NSTextAttachment

Problem: I need a contentMode .scaleAspectFit like property for a image used as a NSTextAttachment. My attachment image does not display well in a pre-set displaySize. Replicate: I set the displaySize ...
husharoonie's user avatar
0 votes
1 answer
90 views

UIScrollView/UITextView scroll indicator insets issue with zero value

We're experiencing odd behavior when configuring UIScrollView's .scrollIndicatorInsets property. Specifically, when we set our UITextView's .scrollIndicatorInsets to UIEdgeInsetsMake(0, 0, 0, 0) the ...
AVS's user avatar
  • 413
-2 votes
1 answer
65 views

UITextView with multi line headline

I faced with the following challenge. I want to make a very first line of text view like a headline. It should be multi line until user tap return button. This is the exact behaviour of Apple Notes ...
Bugrym's user avatar
  • 85
0 votes
1 answer
56 views

Swift TextView detect previous line on backspace

Problem: I need to detect when backspace is tapped and goes back to the previous line. How can we detect a backspace that brings us back to a previous line on a textview, NOT a new line but the ...
husharoonie's user avatar
-1 votes
1 answer
38 views

I have question about differences between UITextView and UITextField

It is kind of simple for you guys but i was spending my whole night to figure this out. my question is that UITextField has a borderStyle Property but UITextView does not have borderStyle Property. ...
Daesoo Ahn's user avatar
0 votes
0 answers
38 views

UITextView Placeholder Giving Second Letter Capitalization

I have a UITextView that has a placeholder similar to Twitter's create post screen. I have implemented the below code however, I am experiencing the below, unexpected behavior: UITextView capitalizes ...
David Henry's user avatar
  • 1,834
0 votes
1 answer
362 views

How to bold TextView with custom Font in Swift?

I want to change my text in textview to BOLD and Italic on button click; but when I do this the custom font which is I am using for my textview also changed; but I want to use custom font. Following ...
noorapps's user avatar

1
2 3 4 5
117