当前位置: 代码迷 >> 综合 >> ios UITextView 输入空两格
  详细解决方案

ios UITextView 输入空两格

热度:12   发布时间:2023-12-15 02:08:54.0


UIKIT_STATIC_INLINE UIEdgeInsets UIEdgeInsetsMake(CGFloat top,CGFloat left, CGFloat bottom,CGFloat right)

 {

    UIEdgeInsets insets = {top, left, bottom, right};

    return insets;

}

    ios7下新增了一个属性textContainerInset,

 _contentTextView.textContainerInset = UIEdgeInsetsMake(1010010);//设置页边距 

   上边距10,左右边距各10,底边距0


   _contentTextView = [[UITextViewalloc]initWithFrame:CGRectMake(0,74,DEVICEWIDTH,90)];

    _contentTextView.backgroundColor = [UIColorwhiteColor];

    _contentTextView.delegate =self;

    _contentTextView.font =TextFont;

    _contentTextView.textColor = [UtilcolorWithHexString:@"999999"];

    _contentTextView.textContainerInset =UIEdgeInsetsMake(10,10,0,10);//设置页边距

    [self.viewaddSubview:_contentTextView];


效果图如下: