UILabel
C_calary
每天进步一点点,我也可以很优秀
展开
-
UILabel的行间距
一般行间距解决办法原创 2016-06-12 11:17:16 · 356 阅读 · 0 评论 -
Swift 改变UILabel字体样式方法
//str:要改变的字 //result:整个label里的字 //color: 字的颜色- (NSMutableAttributedString *)changeSomeText:(NSString *)str inText:(NSString *)result withColor:(UIColor *)color { NSMutableAttributedString *attrib原创 2017-03-17 13:32:16 · 3877 阅读 · 0 评论 -
iOS 计算行高
直接上代码//计算多行高度 + (CGFloat )getStringHeightWithWidth:(CGFloat)width font:(UIFont *)font string:(NSString *)string { NSDictionary *attribute = @{NSFontAttributeName: font}; CGSize size = [string b原创 2017-11-16 11:14:38 · 696 阅读 · 0 评论 -
Swift3.0 label内容高度自适应
///label高度自适应 /// /// - Parameters: /// - text: 文字 /// - labelWidth: 最大宽度 /// - attributes: 字体,行距等 /// - Returns: 高度 func autoLabelHeight(with text:String , labelWidth: CGFloat ,attributes : [Str原创 2016-11-04 18:57:39 · 5421 阅读 · 0 评论 -
Swift 3.0 label富文本
///富文本,改变字体颜色 func changeTextColor(text: String, color: UIColor, range: NSRange) -> NSAttributedString { let attributeStr = NSMutableAttributedString(string: text) attributeStr.addAttribute(NSF原创 2016-11-02 13:43:23 · 2253 阅读 · 0 评论 -
UILabel 加载html类文本
NSString *htmlString = [NSString stringWithFormat:@"<font size='4'><div align='right'>共<font color='red'> %lu </font>件商品, 总计<font color='red'> %.2f </font><原创 2018-11-01 11:04:41 · 1177 阅读 · 0 评论 -
Masonry布局UILabel换行
_infoLabel = [UILabel createNormalLabelWithTitle:@"设置了下面属性就可以换行了"]; // 限制宽 _infoLabel.preferredMaxLayoutWidth = ScreenWidth - 40*UIRate; [_infoLabel setContentHuggingPriority:UILayoutPriorityR...原创 2019-05-06 23:40:41 · 1660 阅读 · 0 评论