国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

獲取button上文字的寬度

2019-11-09 16:39:23
字體:
來源:轉載
供稿:網友

    

    NSDictionary *attributes = @{NSFontAttributeName:[UIFontsystemFontOfSize:17]};

//獲取button上文字

    NSString *title=[_buttoningtitleForState:UIControlStateNormal];

    NSLog(@"button上文字%@",title);

//獲取button上文字的寬度(length 是個定義的一個全局變量)

   length = [title boundingRectWithSize:CGSizeMake(320, 2000)options:NSStringDrawingUsesLineFragmentOriginattributes:attributes context:nil].size.width;

//白色動畫 線

    UIView *redLine =[[UIViewalloc]initWithFrame:CGRectMake(((K_SCERRN_WIDTH / 2)-length)/2, 0,length, 1)];

    [redLine setBackgroundColor:[UIColor whiteColor]];

    self.arrowView = redLine;

    [_line addSubview:redLine];

button事件

[UIView animateWithDuration:0.25 animations:^{

        _arrowView.x = ((K_SCERRN_WIDTH / 2)-length)/2;

    }];

[UIView animateWithDuration:0.25 animations:^{

        _arrowView.x = _buttonend.x+((K_SCERRN_WIDTH / 2)-length)/2;

    }];


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 仪陇县| 秭归县| 含山县| 若羌县| 镇赉县| 明水县| 道孚县| 长治市| 保定市| 绿春县| 盘山县| 康保县| 澄城县| 湛江市| 汨罗市| 盖州市| 通辽市| 易门县| 永福县| 庆安县| 新邵县| 葵青区| 台前县| 开化县| 宝丰县| 株洲市| 海兴县| 闵行区| 五莲县| 长沙县| 新郑市| 宿州市| 同江市| 乌拉特后旗| 池州市| 格尔木市| 百色市| 高平市| 通化县| 漳平市| 禹州市|