适配iOS 10的问题

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. //www.greatytc.com/p/6fe91d58607a
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容