码迷,mamicode.com
首页 > 其他好文 > 详细

2016.04.18 view中嵌套两个居中的 lable

时间:2016-04-18 13:22:24      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:

  

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

    

2016.04.18 view中嵌套两个居中的 lable

标签:

原文地址:http://www.cnblogs.com/gzz2016/p/5403920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!