UITextView去掉单行的边距以及各种坑
来源:互联网 发布:多功能双肩背包 知乎 编辑:程序博客网 时间:2024/06/07 03:39
self.textView.textContainer.lineFragmentPadding = 0; self.textView.textContainerInset = UIEdgeInsetsZero;
只需要以上两行代码即可。这样我们在UITextView中设置的文字就可以左右两边对齐显示。
lineFragmentPading:官方描述:
The amount by which text is inset within line fragment rectangles.
The padding appears at the beginning and end of the line fragment rectangles. The layout manager uses this value to determine the layout width. The default value of this property is 5
.
Line fragment padding is not designed to express text margins. Instead, you should use insets on your text view, adjust the paragraph margin attributes, or change the position of the text view within its superview.
===============================坑2=============
设置textView的文字后,自动滚动到底部问题:
原问题描述地址:点击打开链接
利用上述方法会发现每当view出现的时候会滚动一下,用下面的方法可以完美解决,
解决方法:
[_contentLabel scrollRectToVisible:CGRectZero animated:NO];
阅读全文
0 0
- UITextView去掉单行的边距以及各种坑
- Iphone 关于UITextView 限制单行的解决办法。。
- iOS:去掉UITextView的Padding和Margin
- iOS根据字符串计算UITextView高度,以及各种字符串的限定
- UITextView 单行垂直居中显示
- 关于 iOS UITextView 的各种陨石坑 (一) !
- 去掉UITextView边距
- UITextView的那些坑
- UITextView的那些坑
- IOS的基本控件的使用-UITextView(单行文本输入区域)
- UITextView 行间距设置以及placeholder
- 设置UITextView的行间距
- UITextView的使用以及打开键盘的时候自动调整UITextView的位置
- UITextFiled & UITextView 控制输入长度、中文处理以及UITextView 的placeHolder 的一种实现方法
- git各种命令介绍以及碰到的各种坑
- iOS UITextView设置边距的正确方式
- ListView设置item的行间距,以及去掉分割线
- iOS UITextView实现字数的限制以及字数的累计
- javascript中如何获得div中所有span对象
- 171208之Oracle总结
- c语言练习 插入排序 gcd求解
- 重写easyUI日期控件,只限制年月
- 面向对象程序设计上机练习七(类和对象)
- UITextView去掉单行的边距以及各种坑
- mac 回车键、空格键失灵(非物理原因)解决方法
- 百度地图API中使用ajax实现点击地图生成标注并保存到数据库
- ubuntu16.04.3环境下搭建open face
- CentOS上安装Oracle XE指南
- QT控件大全 十五 QPot
- 设计一个字符串子串删除函数 将结果子串指针返回 用主程序验证
- URL取值编码问题
- std::map用法