[Object-c]UITextView 在边缘位置没有文字的属性 UIEdgeInsets

来源:互联网 发布:金融数据分析师工资 编辑:程序博客网 时间:2024/06/06 01:16

UITextView

目的: 让UITextView上的边缘位置, 不输出文字

属性: textContainerInset (文本适配器)

代码:

textView.textContainerInset = UIEdgeInsetsMake(100, 100, 100, 100);
效果: 文本适配器就会在textView的边缘100像素内没有文字.


UIEdgeInsets . 

 初始化UIEdgeInsets 的方法是UIEdgeInsetsMake.

内部实现:

UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right) {    UIEdgeInsets insets = {top, left, bottom, right};    return insets;}

直接使用:

UIEdgeInsetsMake(100, 100, 100, 100)


0 0
原创粉丝点击