zoukankan      html  css  js  c++  java
  • 第18月第19天 masonry等分 uilabel sizetofit

    1.masonry等分

    mas_distributeViewsAlongAxis

    MASAxisTypeHorizontal

     

    2.uilabel sizetofit

    +(CGSize)labSizeWithStr:(NSString *)_str font:(UIFont *)_font labWidth:(int)_labWidth lineSpacing:(int)_lineSpacing numberOfLines:(int)_numberOfLines{
         
        if (!_str) {
            return CGSizeZero;
        }
     
        UILabel *cLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, _labWidth, 0)];
        [cLabel setFont:_font];
        [cLabel setNumberOfLines:_numberOfLines];
         
        NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
        [paragraphStyle setLineSpacing:_lineSpacing];
         
        [cLabel setAttributedText:[[NSAttributedString alloc] initWithString:_str attributes:@{NSParagraphStyleAttributeName:paragraphStyle}]];
        [cLabel sizeToFit];
         
        CGSize returnSize = cLabel.size;
        cLabel = nil;
         
        return returnSize;
    }

    http://blog.51cto.com/liyun2422/1732186

  • 相关阅读:
    最简单跳转,待反混爻的合集
    搜索引擎劫持代码
    Warning: Cannot modify header information
    editplus 正则删换行
    在全程Linux環境部署IBM Lotus Domino/Notes 8.5
    3.5-杂项②
    3.4-杂项①
    3.3-ISDN
    3.2-帧中继②
    3.2-帧中继①
  • 原文地址:https://www.cnblogs.com/javastart/p/8602760.html
Copyright © 2011-2022 走看看