有没有一种方法可以获得像 UITextField 框一样具有类似周围阴影的 UITextView ?
有没有办法让 UITextView
具有与 UITextField
相同的圆角和内部阴影类型边框?
是否有人可以链接到这样做的链接或信息?我认为它将涉及 UITextView
的子类化,并且它又是 drawRect
?
这似乎是人们普遍想要的东西,所以我认为它已经完成或解决了?
There is a way to get the UITextView
with the rounded corners and inner shadow-y type border identical to a UITextField
?
Is there a link or information out there that someone could link toward doing this? I assume it's going to involve subclassing UITextView
and it's drawRect
again?
It seems like something that people would commonly want though so I assume it's been done or solved already?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的解决方案是将 UIImageView 放在 UITextView 下,同时为 textview 提供清晰的背景色。如果您在常规文本字段的屏幕截图上使用stretchableImageWithLeftCapWidth:topCapHeight:方法,您可以轻松调整该内容的大小并获得良好的结果。
不幸的是,我不认为有更简单的方法......
My solution would be to put a UIImageView under the UITextView, while giving the textview a clear background color. If you use the stretchableImageWithLeftCapWidth:topCapHeight: method on a screencap of a regular textfield, you could easily resize the thing and achieve nice results.
Unfortunately, I don't think there's an easier way...
做四个圆角
然后你可以在 viewDidLoad 中
four rounded corners you can do
then in viewDidLoad