根据ui控件的字体计算占用的长度

时间:2022-04-28 11:45:19
    //1.根据icon计算name的长度
CGFloat nameX = CGRectGetMaxX(_icon.frame) + kBorder;
CGFloat nameY = iconY;
//计算用户昵称的长度
CGSize nameSize = [_weiBo.name sizeWithFont:_name.font];
_name.frame = CGRectMake(nameX, nameY, nameSize.width, nameSize.height); //2.设置vip的frame
CGFloat vipX = CGRectGetMaxX(_name.frame) + kBorder;
CGFloat vipY = nameY;
_vip.frame = CGRectMake(vipX, vipY, , );