Skip to content

Commit da12e47

Browse files
committed
Replace sizeWithFont with boundingRectWithSize, and remove the #pragma clang diagnostic ignored "-Wdeprecated-declarations"
1 parent b1a1996 commit da12e47

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

Example/Classes/Views/PostTableViewCell.m

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,8 @@ + (CGFloat)heightForCellWithPost:(Post *)post {
6161
}
6262

6363
+ (CGFloat)detailTextHeight:(NSString *)text {
64-
#pragma clang diagnostic push
65-
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
66-
CGSize sizeToFit = [text sizeWithFont:[UIFont systemFontOfSize:12.0f] constrainedToSize:CGSizeMake(240.0f, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping];
67-
#pragma clang diagnostic pop
68-
return sizeToFit.height;
64+
CGRect rectToFit = [text boundingRectWithSize:CGSizeMake(240.0f, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12.0f]} context:nil];
65+
return rectToFit.size.height;
6966
}
7067

7168
#pragma mark - UIView

0 commit comments

Comments
 (0)