I'm currently developing a simple text-editing app for iPad. I want to set left/right margins like the attached picture. Just adding UITextView into another UIView with larger width won't work because a scroll indicator won't be properly located.
Instead of UIView, I added UITextView into UIScrollView, and it works almost fine. But they sometimes show strange behaviors, and UITextViewDelegate doesn't work with my UIViewController.
Is there any way to set left/right margins only using UITextView? Thank you.
You can use the property textContainerInset
Following the example of George Green:
myTextView.textContainerInset = UIEdgeInsetsMake(0.0f, 10.0f, 0.0f, 10.0f);
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