我的问题很简单,我认为这是可能的,但我找不到。 我的设计是这样的
我将角半径设为textview
,并将textContainerInset
设置为左右两侧的填充
txtview_msg.textContainerInset = UIEdgeInsetsMake(5, 10, 10, 5)
现在我的问题就像前2行和后2行一样,我的文字在textview下面,所以我需要一些解决方案。
请帮帮我。谢谢
答案 0 :(得分:0)
试试这段代码
UIView *paddingView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, txtview_msg.frame.size.height - 30)];
txtview_msg.leftView = paddingView1;
txtview_msg.leftViewMode = UITextFieldViewModeAlways;
UIView *paddingView2 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, txtview_msg.frame.size.height - 30)];
txtview_msg.leftView = paddingView2;
txtview_msg.rightViewMode = UITextFieldViewModeAlways;
答案 1 :(得分:0)
You can create at first a view of same size how much you given, put cornerRadius
how much you given in textview
now. than create textview
viewSize
- corner radius
. place the textview
exactly in middle of view. set the constraints from that view only, than it will work perfect how you want.
check this attached screenshot: