There are many great examples on SO to remove the left padding of a UITextView.
How to lose margin/padding in UITextView?
However, I need to remove the right padding too.
I have tried...
[tv setContentInset: UIEdgeInsetsMake(-4,-8,-8,-X)];//where X is any integer
and just about every other permutation of the last two values to remove the padding and nothing seems to work. Have also tried
[tv sizeToFit]; [tv setTextAlignment:[NSTextAlignmentRight]];
The following Text in the Textview says "00"
Although it is iOS 7 only, an extremely clean solution is to set the textView's textContainerInsets as such:
[textView setTextContainerInset:UIEdgeInsetsZero]; textView.textContainer.lineFragmentPadding = 0; // to remove left padding
This will effectively remove all padding (insets) around the text inside the text view. If your deployment target is iOS 7+ then this is the best solution thus far.
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