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];

  • 相关阅读:
    uva 11997 K Smallest Sums
    uvalive 3135 Argus
    React-Redux填坑
    fetch方法
    react 学习前期用到的插件
    Redux:with React(一)
    Redux:data flow
    Redux:store
    Redux:Reducers
    Redux:action
  • 原文地址:https://www.cnblogs.com/popper123/p/5181901.html
Copyright © 2011-2022 走看看