国产探花免费观看_亚洲丰满少妇自慰呻吟_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;

    }];


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 嘉义县| 辰溪县| 营口市| 太谷县| 微博| 鄱阳县| 三门峡市| 炉霍县| 北京市| 墨竹工卡县| 常州市| 大庆市| 岢岚县| 五华县| 峡江县| 右玉县| 民勤县| 临城县| 衡阳县| 青神县| 赣州市| 家居| 新巴尔虎右旗| 景宁| 阿瓦提县| 彰武县| 雅江县| 吴旗县| 辽宁省| 芷江| 阿拉善左旗| 石河子市| 文水县| 丽江市| 商丘市| 黑山县| 灵宝市| 鲁甸县| 桓台县| 利辛县| 武穴市|