UILabel补充
来源:互联网 发布:一些计算机算法的例子 编辑:程序博客网 时间:2024/05/16 17:26
NSAttributedString
使用这个类,必须先导入CoreText框架。
给UILabel设置attributedText了会导致给UILabel中text,font,textColor,shadowColor,shadowOffset,textAlignment,lineBreakMode这7个属性设置值时无效果。
这个框架的应用场景一般在图文混排和搜索功能中应用比较多。
需求怎么让搜索的字高亮了。友情提醒:别想歪了,这是之前给的外包项目,不是我特意找的。
- 实例代码
效果:
NSParagraphStyleAttributeName 段落样式
(字符串通过“\n”进行分段,此设置必须在lable.numberOfLines = 0时有效,value通过NSMutableParagraphStyle设置,它有以下属性)
1 @property(readwrite) CGFloat lineSpacing; //行间距 2 @property(readwrite) CGFloat paragraphSpacing; //段间距 3 @property(readwrite) NSTextAlignment alignment; //对齐方式 4 @property(readwrite) CGFloat firstLineHeadIndent; //首行缩紧 5 @property(readwrite) CGFloat headIndent; //除首行之外其他行缩进 6 @property(readwrite) CGFloat tailIndent; //每行容纳字符的宽度 7 @property(readwrite) NSLineBreakMode lineBreakMode; //换行方式 8 @property(readwrite) CGFloat minimumLineHeight; //最小行高 9 @property(readwrite) CGFloat maximumLineHeight; //最大行高10 @property(readwrite) NSWritingDirection baseWritingDirection; //书写方式(NSWritingDirectionNatural,NSWritingDirectionLeftToRight,NSWritingDirectionRightToLeft)11 @property(readwrite) CGFloat lineHeightMultiple;12 @property(readwrite) CGFloat paragraphSpacingBefore;13 @property(readwrite) float hyphenationFactor;14 @property(readwrite,copy,NS_NONATOMIC_IOSONLY) NSArray *tabStops NS_AVAILABLE_IOS(7_0);15 @property(readwrite,NS_NONATOMIC_IOSONLY) CGFloat defaultTabInterval NS_AVAILABLE_IOS(7_0);
最近才开始往github上放东西 在公司写的又不能放= = 大家姑且看看吧
github地址: https://github.com/FuThD
1 0
- UILabel补充
- 让UILabel的文字顶部对齐【补充了一点点】
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UILabel
- UIlabel
- UILabel
- UILabel
- ButterKnife的简单使用
- Sum It Up
- 选择Session还是Cookie
- NVARCHAR 和VARCHAR区别和使用
- java concurrent
- UILabel补充
- 应聘时给HR最漂亮的回答
- Logistic回归(实例)
- CentOS6.5 yum安装配置nginx 以及相关配置
- 第三周上机实践项目 项目1--个人所得税计算器
- PHP表单处理篇
- 关于github for windows 登录失败提示密码账户错误的解决方案
- 【转】unity3d所要知道的基础知识体系大纲
- 十字链表(Java)