zoukankan      html  css  js  c++  java
  • ios 获取字符串所需要占用的label的高度

    //    设置字体大小

        UIFont *fnt=[UIFont systemFontOfSize:16];

        NSDictionary *attribute = @{NSFontAttributeName: fnt};

    //     CGSize retSize; 全局变量

        retSize = [Remark[0] boundingRectWithSize:CGSizeMake(SCREEN_WIDTH, 0)

                                                 options:

                          NSStringDrawingTruncatesLastVisibleLine |

                          NSStringDrawingUsesLineFragmentOrigin |

                          NSStringDrawingUsesFontLeading

                                              attributes:attribute

                                                 context:nil].size;

        

         labels1 = [[UILabel alloc]initWithFrame:CGRectMake(10, Lastview.frame.size.height/2+SCREEN_WIDTH/10, SCREEN_WIDTH-20, retSize.height)];

        labels1.numberOfLines = 0;

        labels1.font =fnt;

       

        labels1.textColor =[UIColor colorWithWhite:0.663 alpha:1.000];

        labels1.text = Remark[0];

        [Lastview addSubview:labels1];

  • 相关阅读:
    POJ 1061
    hihocoder 1330
    HDU 1525
    UVALive 3938
    POJ 2528
    HDU 1754
    《ACM-ICPC程序设计系列 数论及其应用》例题个人答案记录
    URAL 1277
    HDU 3746
    HDU 2087
  • 原文地址:https://www.cnblogs.com/popper123/p/5181901.html
Copyright © 2011-2022 走看看