适配iOS 10的问题

2016-09-14  本文已影响555人  PPAbner

Xcode8 及iOS10适配问题汇总很详细2016-11-01


Xcode没来得及更新,自己手机更新到10了,运行项目,自己负责的代码出现这样情况,我用的是YYLabel!!求助!!!

10之前 10.png
附代码:
 CGFloat introHeight = [self getMessageHeight:introStr andLabel:self.proIntroductLB1];
    self.proIntroductLB1.frame = CGRectMake(85, introductH+8, ScreenWidth-100, introHeight);


/**
 *  获取lb的高度(默认字体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;
}

iOS 10 开发相关最新参考:

  1. Code examples for new APIs of iOS 10.
  2. WWDC 2016 有哪些新技术
  3. http://www.jianshu.com/p/6fe91d58607a
上一篇下一篇

猜你喜欢

热点阅读