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 ...
随机推荐
- str*函数和大小端判断
#include <stdio.h> #include <assert.h> size_t mstrlen(const char *s) { assert(s != NULL) ...
- leetcode@ [51/52] N-Queens
https://leetcode.com/problems/n-queens/ class Solution { public: void dfs(vector<vector<string ...
- Windows 服务 创建 和 安装 -摘自网络
What a Windows Service is Enables you to create long-running executable applications that run in the ...
- sudo 和 sudoers设置
转: http://www.cnblogs.com/zhuowei/archive/2009/04/13/1435190.html sudo是linux下常用的允许普通用户使用超级用户权限的工具,允许 ...
- redis缓存技术
初学redis缓存技术,如果文章写得不好还请谅解 应用环境:win7 实现环境:cmd,eclipse redis缓存技术的特点就在于高效,因为目前涉及的数据量逐渐增多,在对于数据的存储上面和sql以 ...
- salt-minion安装脚本
#!/bin/bash cd /usr/local/src/ wget http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.no ...
- iOS 开发中使用到的小技巧汇总
国庆即将来到,一个小项目也即将完成,把自己在项目中用的一些小技巧写出来,方便查找. 1,去掉分割线--动画设置透明度alpha //去掉tableView的分隔线: self.tableVie ...
- windows 文件名太长无法删除的解决方法
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- JavaScript MVC框架PK:Angular、Backbone、CanJS与Ember
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- Linux多线程的一个小例子
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h& ...