Skip to content
Join us for Free for Full Access to site Content

How to set content inset for UITextView in Swift

In this tutorial, we will disclose a simple thing: How to set content inset for UITextView in Swift:

Let’s say you have the UITextView variable named textView.

To set the insets change the textContainerInset property of the textView.

For example, if you want the following insets: 10 from the top, 10 from the bottom, 20 from the left and right just set it this way:

textView.textContainerInset = UIEdgeInsets(top: 10, left: 20, bottom: 10, right: 20)

Don’t forget to subscribe to AppMakers.Dev mailing list if you love this content and want to stay tuned with recent iOS Development news, tutorials and resources.

Keep in mind that at the moment of writing this post we used Xcode 10 and Swift 5.
If anything will change in the future, it is OK, just use the new API calls.

Back To Top
Search

Get Latest App Development News, Tips and Tutorials

* indicates required


Send this to a friend