NSMutableParagraphStyle /NSParagraphStyle
- // NSParagraphStyleAttributeName 段落的风格(设置首行,行间距,对齐方式什么的)看自己需要什么属性,写什么
- NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
- paragraphStyle.lineSpacing = 10;// 字体的行间距
- paragraphStyle.firstLineHeadIndent = 20.0f;//首行缩进
- paragraphStyle.alignment = NSTextAlignmentJustified;//(两端对齐的)文本对齐方式:(左,中,右,两端对齐,自然)
- paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;//结尾部分的内容以……方式省略 ( "...wxyz" ,"abcd..." ,"ab...yz")
- paragraphStyle.headIndent = 20;//整体缩进(首行除外)
- paragraphStyle.tailIndent = 20;//
- paragraphStyle.minimumLineHeight = 10;//最低行高
- paragraphStyle.maximumLineHeight = 20;//最大行高
- paragraphStyle.paragraphSpacing = 15;//段与段之间的间距
- paragraphStyle.paragraphSpacingBefore = 22.0f;// 段首行空白空间 /* Distance between the bottom of the previous paragraph (or the end of its paragraphSpacing, if any) and the top of this paragraph. */
- paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;//从左到右的书写方向(一共➡️三种)
- paragraphStyle.lineHeightMultiple = 15;/* Natural line height is multiplied by this factor (if positive) before being constrained by minimum and maximum line height. */
- paragraphStyle.hyphenationFactor = 1;//连字属性 在iOS,唯一支持的值分别为0和1
- /*
- NSFontAttributeName 字体大小
- NSParagraphStyleAttributeName 段落的风格(设置首行,行间距,对齐方式什么的)
- NSKernAttributeName 字间距
- */
- NSDictionary *attributes = @{
- NSFontAttributeName:[UIFont systemFontOfSize:15],
- NSParagraphStyleAttributeName:paragraphStyle,
- NSKernAttributeName:@(10),
- };
- textView.attributedText = [[NSAttributedString alloc] initWithString:textView.text attributes:attributes];
NSMutableParagraphStyle /NSParagraphStyle的更多相关文章
- iOS开发富文本制作 图片和文字/NSMutableParagraphStyle/NSMutableAttributedString
/NSMutableParagraphStyle/NSMutableAttributedString 组合使 NSString * titlestr=@"日产GT-R"; NSMu ...
- iOS-文本段落样式NSMutableParagraphStyle与NSParagraphStyle的使用和一些富文本处理属性
开发过程中,经常会遇到动态计算行高的问题, - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)op ...
- ios开发之--NSMutableParagraphStyle与NSParagraphStyle的使用
在ios6以后,苹果官方建议用“- (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options ...
- ios--Attributes和ParagraphStyle介绍
NSMutableParagraphStyle的部分属性: typedef NS_ENUM(NSInteger, NSLineBreakMode) {/* What to do with long l ...
- iOS小技巧总结,绝对有你想要的
原文链接 在这里总结一些iOS开发中的小技巧,能大大方便我们的开发,持续更新. UITableView的Group样式下顶部空白处理 //分组列表头部空白处理 UIView *view = [[UIV ...
- cell的自适应
+(CGFloat)getCellHeightWithItem:(FXOwnershipStrutureInfo *)item { if (item.rowH) {//如有rowH就直接返回,避免重新 ...
- ios 中的小技巧 - 总有你想要的 一
UITableView的Group样式下顶部空白处理 在viewWillAppear里面添加如下代码: //分组列表头部空白处理 CGRect frame = myTableView.tableHea ...
- IOS-小技巧总结,绝对有你想要的
1.App名称的修改 许多个人开发者或许会有和我一样的经历,开发一个App途中会想到更合适的名字,这时候变会修改工程名以达到App名称改变的目的,其实你可以一步到位—— 在info.plist中添加一 ...
- iOS开发常用代码块(第二弹)
GCD定时器 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, ); dispat ...
随机推荐
- 都说ConcurrentDictionary<TKey, TValue>有陷阱
看这么几句解释(英文原帖): private static void ConcurrentDictionary() { var dict = new ConcurrentDictionary<i ...
- 【HTML】Advanced4:Accessible Links
1.Tab <ul> <li><a href="here.html" tabindex="1">Here</a> ...
- HW4.45
public class Solution { public static void main(String[] args) { int count = 0; for(int i = 1; i < ...
- 新浪微博、腾讯微博、QQ空间、人人网、豆瓣 一键分享API
新浪微博: http://service.weibo.com/share/share.php?url= count=表示是否显示当前页面被分享数量(1显示)(可选,允许为空) & url=将页 ...
- X265编码效率仍然低
本次测试软件环境:Intel Celeron双核 2.60 Ghz CPU; 4GB 内存:安装 Ubuntu 13.04 hzsx@hzsx-server:~$ lsb_release -a No ...
- unexpected error ConnectionError object has no attribute
unexpected error ConnectionError object has no attribute
- YII访问数据库
YII访问数据库 CDbConnection: 一个抽象数据库连接 CDbCommand: SQL statement CDbDataReader: 匹配结果集的一行记录 CDbTransaction ...
- Maintainable JavaScript(编写可维护的JavaScript) PART I Style Guidelines
“Programs are meant to be read by humans and only incidentally( 顺便:偶然地:附带地) for computers to execute ...
- Android UI开发第三十四篇——SlidingPaneLayout
SlidingPaneLayout也是系统支持的高级控件,是Android团对在2013 google IO大会期间更新的Support库(Version 13)中新加入的重要的功能.它支持左右滑动菜 ...
- Codeforces Round #382 (Div. 2)E. Ostap and Tree
E. Ostap and Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard i ...