[英]sizeWithFont: minFontSize is Deprecated in iOS7
- (CGFloat)heightForTitleLabel
{
if (self.titleLabel) {
CGSize size = [self.title sizeWithFont:self.titleLabel.font
minFontSize:
#ifndef __IPHONE_6_0
self.titleLabel.font.pointSize * self.titleLabel.minimumScaleFactor
#else
self.titleLabel.minimumScaleFactor
#endif
actualFontSize:nil
forWidth:CONTAINER_WIDTH - CONTENT_PADDING_LEFT * 2
lineBreakMode:self.titleLabel.lineBreakMode];
return size.height;
}
return 0;
}
- (CGFloat)heightForMessageLabel
{
CGFloat minHeight = MESSAGE_MIN_LINE_COUNT * self.messageLabel.font.lineHeight;
if (self.messageLabel) {
CGFloat maxHeight = MESSAGE_MAX_LINE_COUNT * self.messageLabel.font.lineHeight;
CGSize size = [self.message sizeWithFont:self.messageLabel.font
constrainedToSize:CGSizeMake(CONTAINER_WIDTH - CONTENT_PADDING_LEFT * 2, maxHeight)
lineBreakMode:self.messageLabel.lineBreakMode];
return MAX(minHeight, size.height);
}
return minHeight;
}
Here is my question. 这是我的问题。 I have read other posts about this deprecation in iOS 7, however I can't seem to get them to work for my specific case. 我在iOS 7中阅读了有关此弃用的其他文章,但是我似乎无法让它们在我的特定情况下起作用。 Are there any other alternatives for this problem, and any that would work in this situation? 是否有其他替代方法可以解决此问题,并且在这种情况下可行?
UILabel * label;
label.adjustsFontSizeToFitWidth = YES;
label.minimumScaleFactor = 0.5;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.