zoukankan      html  css  js  c++  java
  • 2016.04.18 view中嵌套两个居中的 lable

      

     UIView *bgRight=[[UIView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2, 35)];

        bgRight.backgroundColor=[UIColor whiteColor];

        [bgView addSubview:bgRight];

        

       //gzz0121

        UILabel *labSelvieR = [[UILabel alloc]initWithFrame:CGRectMake(0,11, 120, 20)];

        labSelvieR.text = @"患者送花数";

        labSelvieR.font = SYSTEMFONT(13);

        labSelvieR.textColor = [UIColor blackColor];

        labSelvieR.textAlignment=NSTextAlignmentLeft;

        labSelvieR.backgroundColor=[UIColor clearColor];

        [labSelvieR sizeToFit];//gzz0418

        [bgRight addSubview:labSelvieR];

        

        UILabel *labAmoutR = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(labSelvie.frame)+15,7, 50, 20)];

        labAmoutR.text = [NSString stringWithFormat:@"%@",sendFlowerNumStr];

        labAmoutR.font = SYSTEMFONT(13);

        labAmoutR.textColor =BGCOLOR;

        labAmoutR.textAlignment=NSTextAlignmentLeft;

        [labAmoutR sizeToFit];

        labAmoutR.centerY=labSelvieR.centerY;

        [bgRight addSubview:labAmoutR];

        

        CGFloat Centr=SCREEN_WIDTH/2-labSelvieR.width-labAmoutR.width-15;

        CGFloat  WidtddR=labSelvieR.width+labAmoutR.width+15;

        bgRight.frame=CGRectMake(Centr/2+SCREEN_WIDTH/2, bgRight.y, WidtddR, bgRight.height);

        

  • 相关阅读:
    四种wordpress常用的循环结构
    自动创建网页文章目录结构
    shell
    SSH
    架构
    Https
    if-else、switch、while、for
    do-while
    const
    Tail Call
  • 原文地址:https://www.cnblogs.com/gzz2016/p/5403920.html
Copyright © 2011-2022 走看看