【发布时间】:2011-12-15 17:20:57
【问题描述】:
正如标题所说,我正在尝试向 UITextView 添加类似填充的行为。当视图被推入我的导航控制器并发生以下代码时,会生成文本视图:
self.textView.layer.cornerRadius = 7;
//pretty stuff is pretty
NSString *description = appDelegate.productInDisplay.description;
[self.textView setText:description];
//pretty stuff has content now
CGRect frame = textView.frame;
frame.size.height = textView.contentSize.height;
textView.frame = frame;
//set the UITextView to the size of it's containing text.
self.textView.editable = NO;
self.theScrollView.contentSize = CGSizeMake(320, 250 + textView.frame.size.height);
//set the parent scrollView's height to fit some other elements with fixed size (250)
//and the pre-mentioned UITextView
所以,这一切正常,没关系,但我想在 UITextView 的所有 4 个侧面添加一些填充,我无法通过 3 小时的谷歌搜索来完成此操作,这似乎很容易。有什么建议吗?
【问题讨论】:
-
这只是.. uitextview.textContainerInset = UIEdgeInsetsMake(8,5,8,5); // 上、左、下、右 ... 就这么简单
标签: ios uitextview padding