I created UITextview programmatically and I need set some left margin in text. I do this like:
myTextView.contentInset = UIEdgeInsetsMake(0.0, 5.0, 0.0, 0.0);
this working, but now I have horizontal scrolling.
I try set contentSize
less than my text view frame (it equals 320 pt).
This
myTextView.contentSize = CGSizeMake(300.0, 39.0);
don't help.
I need to set left margin for text and only vertical scrolling.
To hide the horizontal scrollbar and prevent horizontal scrolling, use overflow-x: hidden: HTML. CSS.
Set the overflow-y: hidden; and overflow-x: auto; that will automatically hide the vertical scroll bar and present only the horizontal scrollbar. The white-space: nowrap; property is used to wrap text in a single line. Here the scroll div will be horizontally scrollable.
Check all of your elements on "Mobile" view, and remove any high margins to the left or to the right side of the element. The mobile horizontal scrolling has been caused by setting a high fixed / minimum width for an element. Set elements to "auto", or just reduce the width on mobile devices.
In stead of contentInset, use textContainerInset (iOS 7.0+)
myTextView.textContainerInset = UIEdgeInsetsMake(0.0, 5.0, 0.0, 0.0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With