為了自己傻逼的行為記錄一章,以后會(huì)不斷更新修然,希望大家不要學(xué)我。
今天最傻逼的行為是:
Paste_Image.png
明星項(xiàng)目 + 項(xiàng)目標(biāo)題 Label 顯示, 自己一開始的做法是在Label中的String 添加 空格 沒錯(cuò)是空格过牙,讓空格去替代 明星項(xiàng)目的位置。
最后發(fā)現(xiàn) 在iOS9 iOS10 中是界面顯示不對(duì)纺铭, 因?yàn)閕OS10的字體換了寇钉,計(jì)算長(zhǎng)度除了問題。
解決辦法就是: firstLineHeadIndent
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
[paragraphStyle setFirstLineHeadIndent:60];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [title length])];
/*
NSMutableParagraphStyle與NSParagraphStyle包括一下屬性
alignment //對(duì)齊方式
firstLineHeadIndent //首行縮進(jìn)
headIndent //縮進(jìn)
tailIndent //尾部縮進(jìn)
lineBreakMode //斷行方式
maximumLineHeight //最大行高
minimumLineHeight //最低行高
lineSpacing //行距
paragraphSpacing //段距
paragraphSpacingBefore //段首空間
baseWritingDirection //句子方向
lineHeightMultiple //可變行高,乘因數(shù)舶赔。
hyphenationFactor //連字符屬性
NSString *const NSForegroundColorAttributeName;//值為UIColor扫倡,字體顏色,默認(rèn)為黑色竟纳。
*/