Xcode8 及iOS10適配問(wèn)題匯總
很詳細(xì)2016-11-01
Xcode沒(méi)來(lái)得及更新管怠,自己手機(jī)更新到10了淆衷,運(yùn)行項(xiàng)目,自己負(fù)責(zé)的代碼出現(xiàn)這樣情況渤弛,我用的是YYLabel!!求助WU!她肯!
10之前
10.png
附代碼:
CGFloat introHeight = [self getMessageHeight:introStr andLabel:self.proIntroductLB1];
self.proIntroductLB1.frame = CGRectMake(85, introductH+8, ScreenWidth-100, introHeight);
/**
* 獲取lb的高度(默認(rèn)字體13佳头,行間距8,lb寬ScreenWidth-100)
* @param mess lb.text
* @param lb (YYLabel *)label
* @return lb的高度
*/
-(CGFloat)getMessageHeight:(NSString *)mess andLabel:(YYLabel *)lb
{
NSMutableAttributedString *introText = [[NSMutableAttributedString alloc] initWithString:mess];
introText.yy_font = FontSet(13);
introText.yy_lineSpacing = 8;
lb.attributedText = introText;
CGSize introSize = CGSizeMake(ScreenWidth-100, CGFLOAT_MAX);
YYTextLayout *layout = [YYTextLayout layoutWithContainerSize:introSize text:introText];
lb.textLayout = layout;
CGFloat introHeight = layout.textBoundingSize.height;
return introHeight;
}