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

    }];


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 佳木斯市| 张掖市| 明星| 安图县| 吉林省| 南安市| 邹平县| 子洲县| 潍坊市| 视频| 南投市| 滨州市| 腾冲县| 宁波市| 镇康县| 沧州市| 泰来县| 铁力市| 金门县| 崇文区| 宜兰市| 巴里| 河南省| 凤翔县| 多伦县| 临漳县| 双峰县| 汉川市| 建宁县| 乌鲁木齐县| 勃利县| 五大连池市| 诸城市| 达孜县| 扬州市| 义乌市| 昭苏县| 安阳市| 新晃| 屯昌县| 二连浩特市|