UITextView with bottom padding

Go To StackoverFlow.com

2

So I wanted to create something like this:

enter image description here

Basically I wanted to have that bottom padding of around 20 px of height for that text count. I've tried setting the inset, but it doesn't work.. how can I do this so that there will always be a 20 px at the bottom of the text view?

Here's what I did:

 [self.comments_ setScrollIndicatorInsets:UIEdgeInsetsMake(0, 0, 25, 0)];
    [self.comments_ setContentInset:UIEdgeInsetsMake(0, 0, 25, 0)];

but I am still getting text on that bottom padding when it overflows.. any idea? This is from the float app reader

2012-04-04 22:08
by adit
Any chance the "355" is just a label sitting below a text view in a common superview - Phillip Mills 2012-04-04 22:19
That's what I am going to do if there's no way to do this without just having a UITextView and doing some manipulation on padding - adit 2012-04-04 22:31


1

Try wrapping your UITextView within a UIView with the padded dimensions. It would look something like this:

UITextView *textView = [[[UITextView alloc] initWithFrame:CGRectMake(5, 5, 100, 50)] autorelease];
textView.text = @"Lorem ipsum";
textView.backgroundColor = [UIColor clearColor];

UIView *view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 110, 80)] autorelease];
[view addSubview:textView];

This would pad the text view 5px on each side, except for the 25px bottom padding. Maybe I missed some detail, but the frames part is the one that should help you.

2012-04-04 22:43
by Bojan Dimovski
Ads