1. //   NSParagraphStyleAttributeName 段落的风格(设置首行,行间距,对齐方式什么的)看自己需要什么属性,写什么
    2. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    3. paragraphStyle.lineSpacing = 10;// 字体的行间距
    4. paragraphStyle.firstLineHeadIndent = 20.0f;//首行缩进
    5. paragraphStyle.alignment = NSTextAlignmentJustified;//(两端对齐的)文本对齐方式:(左,中,右,两端对齐,自然)
    6. paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;//结尾部分的内容以……方式省略 ( "...wxyz" ,"abcd..." ,"ab...yz")
    7. paragraphStyle.headIndent = 20;//整体缩进(首行除外)
    8. paragraphStyle.tailIndent = 20;//
    9. paragraphStyle.minimumLineHeight = 10;//最低行高
    10. paragraphStyle.maximumLineHeight = 20;//最大行高
    11. paragraphStyle.paragraphSpacing = 15;//段与段之间的间距
    12. 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. */
    13. paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;//从左到右的书写方向(一共➡️三种)
    14. paragraphStyle.lineHeightMultiple = 15;/* Natural line height is multiplied by this factor (if positive) before being constrained by minimum and maximum line height. */
    15. paragraphStyle.hyphenationFactor = 1;//连字属性 在iOS,唯一支持的值分别为0和1
    16. /*
    17. NSFontAttributeName 字体大小
    18. NSParagraphStyleAttributeName 段落的风格(设置首行,行间距,对齐方式什么的)
    19. NSKernAttributeName 字间距
    20. */
    21. NSDictionary *attributes = @{
    22. NSFontAttributeName:[UIFont systemFontOfSize:15],
    23. NSParagraphStyleAttributeName:paragraphStyle,
    24. NSKernAttributeName:@(10),
    25. };
    26. textView.attributedText = [[NSAttributedString alloc] initWithString:textView.text attributes:attributes];

NSMutableParagraphStyle /NSParagraphStyle的更多相关文章

  1. iOS开发富文本制作 图片和文字/NSMutableParagraphStyle/NSMutableAttributedString

    /NSMutableParagraphStyle/NSMutableAttributedString 组合使 NSString * titlestr=@"日产GT-R"; NSMu ...

  2. iOS-文本段落样式NSMutableParagraphStyle与NSParagraphStyle的使用和一些富文本处理属性

    开发过程中,经常会遇到动态计算行高的问题, - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)op ...

  3. ios开发之--NSMutableParagraphStyle与NSParagraphStyle的使用

    在ios6以后,苹果官方建议用“- (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options ...

  4. ios--Attributes和ParagraphStyle介绍

    NSMutableParagraphStyle的部分属性: typedef NS_ENUM(NSInteger, NSLineBreakMode) {/* What to do with long l ...

  5. iOS小技巧总结,绝对有你想要的

    原文链接 在这里总结一些iOS开发中的小技巧,能大大方便我们的开发,持续更新. UITableView的Group样式下顶部空白处理 //分组列表头部空白处理 UIView *view = [[UIV ...

  6. cell的自适应

    +(CGFloat)getCellHeightWithItem:(FXOwnershipStrutureInfo *)item { if (item.rowH) {//如有rowH就直接返回,避免重新 ...

  7. ios 中的小技巧 - 总有你想要的 一

    UITableView的Group样式下顶部空白处理 在viewWillAppear里面添加如下代码: //分组列表头部空白处理 CGRect frame = myTableView.tableHea ...

  8. IOS-小技巧总结,绝对有你想要的

    1.App名称的修改 许多个人开发者或许会有和我一样的经历,开发一个App途中会想到更合适的名字,这时候变会修改工程名以达到App名称改变的目的,其实你可以一步到位—— 在info.plist中添加一 ...

  9. iOS开发常用代码块(第二弹)

    GCD定时器 dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, ); dispat ...

随机推荐

  1. 都说ConcurrentDictionary<TKey, TValue>有陷阱

    看这么几句解释(英文原帖): private static void ConcurrentDictionary() { var dict = new ConcurrentDictionary<i ...

  2. 【HTML】Advanced4:Accessible Links

    1.Tab <ul> <li><a href="here.html" tabindex="1">Here</a> ...

  3. HW4.45

    public class Solution { public static void main(String[] args) { int count = 0; for(int i = 1; i < ...

  4. 新浪微博、腾讯微博、QQ空间、人人网、豆瓣 一键分享API

    新浪微博: http://service.weibo.com/share/share.php?url= count=表示是否显示当前页面被分享数量(1显示)(可选,允许为空) & url=将页 ...

  5. X265编码效率仍然低

    本次测试软件环境:Intel Celeron双核 2.60 Ghz CPU; 4GB 内存:安装 Ubuntu 13.04 hzsx@hzsx-server:~$ lsb_release -a No ...

  6. unexpected error ConnectionError object has no attribute

    unexpected error ConnectionError object has no attribute

  7. YII访问数据库

    YII访问数据库 CDbConnection: 一个抽象数据库连接 CDbCommand: SQL statement CDbDataReader: 匹配结果集的一行记录 CDbTransaction ...

  8. Maintainable JavaScript(编写可维护的JavaScript) PART I Style Guidelines

    “Programs are meant to be read by humans and only incidentally( 顺便:偶然地:附带地) for computers to execute ...

  9. Android UI开发第三十四篇——SlidingPaneLayout

    SlidingPaneLayout也是系统支持的高级控件,是Android团对在2013 google IO大会期间更新的Support库(Version 13)中新加入的重要的功能.它支持左右滑动菜 ...

  10. 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 ...