UITextView contentInset not working in UITextView on iOS 7?
Asked Answered
L

1

6

I'm trying to set a UITextView's contentInset property. When doing so, the UIEdgeInset's top variable works just fine. So [self.textView setContentInset: 'UIEdgeInsetsMake(50, 0, 0, 0)]; works.

But assigning any other variable of UIEdgeInsets doesn't work. Only the top adjusts. bottom doesn't adjust, neither do left or right.

So [self.textView setContentInset: UIEdgeInsetsMake(0, 50, 100, 50)]; doesn't do anything to my textView.

Am I missing something? Any ideas?

Landan answered 5/10, 2013 at 22:41 Comment(4)
Nope, still no solution.Landan
Still no solution? I am having the same problem in the iPad with the TextView getting covered up by the keyboard...Palp
I've given up contentInsets since it seems to be a bug on Apple's part. I suggest those with similar problems to try and take advantage of adjusting contentOffset to try and replicate what you would originally do with insets.Landan
Do you have any layout constraints that would override the expected behaviour at the bottom of the field ?Hornbill
S
13

Use setTextContainerInset instead of contentInset on iOS 7.

[self.textView  setTextContainerInset:UIEdgeInsetsMake(0, 50, 100, 50)];
Stefansson answered 22/10, 2013 at 21:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.