mitchkman
mitchkman

Reputation: 6680

Right padding does not work in iOS

this is how I've adjusted an UITextView using the interface builder. It is latched showing the blue dashed lines in order to apply the default padding.

enter image description here

And this is how it looks at runtime on an iPhone 5 and 6:

enter image description here

Upvotes: 1

Views: 98

Answers (2)

Rafał Sroka
Rafał Sroka

Reputation: 40028

You have to add leading and trailing constraints that would keep the view from resizing to fit its content.

enter image description here

Then, the layout might be still ambiguous. This is indicated by orange color. You can add the missing constrains manually or let Xcode do it for you. Here is how to do it:

enter image description here

I recommend investing around 20-30 minutes in reading any tutorial on auto layout. It's worth it. The concept is very simple and it's easy to understand.

Upvotes: 1

user3683896
user3683896

Reputation: 11

I think you're using the Auto Layout feature. You can check out this by clicking on the root view in the interface builder and watch the autolayout checkmark on the component inspector panel .

If the autolayout is enabled you need to add constraines for your UITextView. Hope this link will be helpfull: https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithConstraints/WorkingwithConstraints.html

Upvotes: 1

Related Questions