我想有文字大小的变化时,像图像使用自动布局不同的大小类。谢谢!
发布于 2015-11-17 06:59:50
如果针对最大屏幕进行设计,则可以使用标注上的Autoshrink设置使文本适合标注尺寸的减小,否则,如果要同时拉伸和收缩,则必须通过代码来实现
发布于 2015-11-17 18:17:14
try this
-(CGSize)heigtForCellwithString:(NSString *)stringValue withFont:(UIFont*)font{
CGSize constraint = CGSizeMake(250,9999); // Replace 300 with your label width
NSDictionary *attributes = @{NSFontAttributeName: font};
CGRect rect = [stringValue boundingRectWithSize:constraint options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) attributes:attributes context:nil];
return rect.size;
}https://stackoverflow.com/questions/33744810
复制相似问题