美文网首页
适配iOS 10的问题

适配iOS 10的问题

作者: PPAbner | 来源:发表于2016-09-14 14:48 被阅读555次

    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

    相关文章

      网友评论

          本文标题:适配iOS 10的问题

          本文链接:https://www.haomeiwen.com/subject/eopvettx.html