views:

91

answers:

1

I have a UITextView for text editing. By default, it has a small margin around the text. I want to increase that margin by a few pixels.

The contentInset property gives me margins, but it does not change the text "wrap width". The text is wrapped at the same width, and the extra "margin" just causes the view to scroll horizontally.

Is there a way to make a UITextView of a certain width display the text with a narrower "wrap width"?

+2  A: 

You could just use a smaller UITextView, and place a UIView in the background to simulate the padding.

+----------+
|          | <-- UIView (as background)
|   +--+   |
|   |  | <---- UITextView
|   |  |   |
|   +--+   |
|          |
+----------+
KennyTM
Yeah, that's what I'm doing now. Works okay for the side margins, but the top margin has issues. From the user's perspective, text gets "cut off" at the top while scrolling because text only renders in the UITextView.
strawtarget