首页 > 代码库 > iOS动态修改UILabel的宽度

iOS动态修改UILabel的宽度

sizeWithFont在ios7.0之后失效


cell.myCourse.text=cell_info.course;


cell.myCourse.font=FONT;


CGSize myCourseSize=[cell.myCourse.textsizeWithAttributes:[NSDictionarydictionaryWithObjectsAndKeys:cell.myCourse.font,NSFontAttributeName,nil]];


cell.myCourse.frame=CGRectMake(cell.myStatusLabel.frame.origin.x, cell.myStatusLabel.frame.origin.y+cell.myStatusLabel.frame.size.height+3,

 myCourseSize.width, myCourseSize.height);

iOS动态修改UILabel的宽度