Selectable read-only multiline text field on iOS

While working on the iOS mobile application I faced a business requirement to let user copy a part of data from a long text field without letting him modifying the content.

Here is what I was to achieve

And here is what I had using an UITextView

The solution consists of three simple steps:

  1. Block text editing but keep text selection

2. Let UITextView adjust its height to fit all content

3. Remove text padding inside UITextView to make it look more like UILabel

Check out related articles on how to achieve this behavior on native Android and Xamarin.Forms.

--

--

Anna Leushchenko πŸ‘©β€πŸ’»πŸ’™πŸ“±πŸ‡ΊπŸ‡¦

Google Developer Expert in Dart and Flutter | Author, speaker at tech events, mentor, OSS contributor | Passionate mobile apps creator