[英]NSTextView round corners and draw background
For two I've been working on following problem: 对于两个我一直在努力解决以下问题:
I'm supposed to create message chat view which is going to be placed in NSTableView
. 我应该创建消息聊天视图,它将放在NSTableView
。 It has to have color background, rounded corners, custom margins. 它必须有彩色背景,圆角,自定义边距。 I tried with NSTextField
but with no success. 我试过NSTextField
但没有成功。 I have desired background and rounded corners but text is not displayed correctly because it starts in the center of the field in case of multiline. 我有所需的背景和圆角,但文字显示不正确,因为它在多行的情况下从字段的中心开始。 Also I tried with NSTextView
, which seems to be better solution in this situation, but I couldn't set rounded corners. 此外,我尝试使用NSTextView
,这似乎是在这种情况下更好的解决方案,但我无法设置圆角。 I tried using [textView.layer setCornerRadius:7.0];
我尝试使用[textView.layer setCornerRadius:7.0];
but it gives no effect. 但它没有任何效果。
Thanks for any reply! 谢谢你的回复!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.