NSAttributedString左侧间距

时间:2016-03-18 09:48:25

标签: ios swift uiview

我在NSAttributedString中有一个UITextView。我需要在信之前添加一些空格。我需要类似NSKernAttributeName的东西,但是对于左边距,因为NSKernAttributeName在右侧添加了空格。

enter image description here

1 个答案:

答案 0 :(得分:-1)

textfield.leftView= [[UIView alloc]initWithFrame:CGRectMake(0, 0, 20, 0)];
textfield.leftViewMode= UITextFieldViewModeAlways;
textfield.rightView= [[UIView alloc]initWithFrame:CGRectMake(0, 0, 20, 0)];
textfield.UITextFieldViewMode= UITextFieldViewModeAlways;

试试这个男人