koss
koss

Reputation: 874

iOS how to insert UITextField inline within UITextView

Is there a way to insert text inputs inline inside a block of text? I need to allow users to input some data inline within text. I thought that I would be able to use NSMutableString with attachments, but it seems to support only UIImage as attachments.

This is an example of what I'm trying to achieve:

enter image description here

Thanks!

Upvotes: 2

Views: 399

Answers (2)

clemens
clemens

Reputation: 17712

You should take a closer look to CoreText which gives you a very fine grained access to text layout. But anyway, this is a difficult task. You may create a HTML-Page with input fields and display it in a WKWebView, which should be much easier to implement.

Upvotes: 1

Shamsudheen TK
Shamsudheen TK

Reputation: 31311

If the text is static, create a custom UIView class, and position the UILabel and UITextView controls. This is the only possible approach.

If the text is dynamic, you can make use of Auto-layout concept along with the above approach.

Upvotes: 0

Related Questions