UILabel 首行缩进两个字符
2016-07-27 14:45
375 查看
NSString *_test = @"首行缩进根据字体大小自动调整 间隔可自定根据需求随意改变。。。。。。。" ; NSMutableParagraphStyle *paraStyle01 = [[NSMutableParagraphStyle alloc] init]; paraStyle01.alignment = NSTextAlignmentLeft; //对齐 paraStyle01.headIndent = 0.0f;//行首缩进 //参数:(字体大小17号字乘以2,34f即首行空出两个字符) CGFloat emptylen = self.contentLabel.font.pointSize * 2; paraStyle01.firstLineHeadIndent = emptylen;//首行缩进 paraStyle01.tailIndent = 0.0f;//行尾缩进 paraStyle01.lineSpacing = 2.0f;//行间距 NSAttributedString *attrText = [[NSAttributedString alloc] initWithString:_test attributes:@{NSParagraphStyleAttributeName:paraStyle01}]; self.contentLabel.attributedText = attrText;
相关文章推荐
- Error:Execution failed for task...finished with non-zero exit value 2
- SVN使用报错 Synchronize operation failed. RA layer request failed svn: REPORT request on
- Java中连结MySQL启用预编译的先决条件是useServerPstmts=true.
- UIView release, message send to deallocated instance
- Java中break、continue与return的区别
- 对uiview实现部分圆角
- Bluetooth-->蓝牙开发之状态判断
- UITableViewCell显示动画
- UIView非常用方法及属性详解
- hdu 1005 Number Sequence
- Rescue
- Android酷炫实用的开源框架(UI)
- MiniGUI.cfg 文件详解
- String、StringBuffer和StringBuilder
- Android Studio里面的Build.gradle的详细配置说明
- building-librtmp-for-ios
- iOS UINavigationController控制view在navigation item下,在bottom bar上
- poj_2778_DNA Sequence(AC自动机+矩阵)
- 救济金发放 (The Dole QUEUE UVa 133)
- com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK assets/com.xx.xx