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

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

獲取button上文字的寬度

2019-11-09 17:42:48
字體:
來源:轉載
供稿:網友

    

    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;

    }];


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 静海县| 礼泉县| 江陵县| 蓬莱市| 沈阳市| 怀来县| 丽江市| 北票市| 江北区| 梨树县| 电白县| 日土县| 荃湾区| 南投县| 克拉玛依市| 莫力| 东乡族自治县| 子洲县| 全州县| 合肥市| 满城县| 宁强县| 双辽市| 贺州市| 青龙| 四子王旗| 乌恰县| 连城县| 共和县| 五家渠市| 宁津县| 甘洛县| 房产| 舒兰市| 建瓯市| 铁力市| 西青区| 扎囊县| 宿州市| 丘北县| 沙洋县|