我有一个UITableView
, 填充自定义单元格。自定义单元格有许多标签。一个标签从数据库中获取不同大小的字符串。我想要的是下一个标签在第一个标签之后(在第一个标签字符串的末尾)开始。我使用了这段代码:
cell.Manufactlbl.adjustsFontSizeToFitWidth=YES;
CGSize lLabelSIze = [coffeeObj.price sizeWithFont: cell.Manufactlbl.fontforWidth:cell.Manufactlbl.frame.size.width lineBreakMode:cell.Manufactlbl.lineBreakMode];
cell.Manufactlbl.frame = CGRectMake(cell.Manufactlbl.frame.origin.x, cell.Manufactlbl.frame.origin.y, cell.Manufactlbl.frame.size.width, lLabelSIze.height);
cell.Manufactlbl.font=[UIFont systemFontOfSize:12];
cell.Manufactlbl.text=coffeeObj.price;
cell.Typelbl.frame=CGRectMake(cell.Manufactlbl.frame.origin.x + cell.Manufactlbl.frame.size.width, cell.Typelbl.frame.origin.y, cell.Typelbl.frame.size.width, cell.Typelbl.frame.size.height);
cell.Typelbl.font=[UIFont systemFontOfSize:12];
cell.Typelbl.text=coffeeObj.instrument;`
但这不起作用。