|
|
@@ -56,17 +56,20 @@
|
|
|
//标题高度
|
|
|
CGFloat titleHeight = 0;
|
|
|
if (self.title.length > 0) {
|
|
|
+ UIFont *titleFont = [MOSystemNormalCellData getTheFontWithSize:15.0 AndFontName:@"Roboto-Bold"];
|
|
|
titleHeight = [self.title boundingRectWithSize:CGSizeMake(contentWidth, MAXFLOAT)
|
|
|
- options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : [UIFont fontWithName:@"Roboto Bold" size:15.0]}
|
|
|
+ options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName : titleFont}
|
|
|
context:nil].size.height;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//内容高度
|
|
|
CGFloat contentHeight = 0;
|
|
|
if(self.content.length > 0){
|
|
|
+ UIFont *contentFont = [MOSystemNormalCellData getTheFontWithSize:13.0 AndFontName:@"Roboto"];
|
|
|
contentHeight = [self.content boundingRectWithSize:CGSizeMake(contentWidth, MAXFLOAT)
|
|
|
options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading
|
|
|
- attributes:@{NSFontAttributeName : [UIFont fontWithName:@"Roboto" size:13.0]}
|
|
|
+ attributes:@{NSFontAttributeName : contentFont}
|
|
|
context:nil].size.height + 2.5;//补偿2.5的偏差
|
|
|
}
|
|
|
|
|
|
@@ -110,4 +113,27 @@
|
|
|
return [object isEqual:[NSNull null]] ? nil : object;
|
|
|
}
|
|
|
|
|
|
++ (UIFont *)getTheFontWithSize:(CGFloat)fontSize AndFontName:(NSString *)fontName{
|
|
|
+ UIFont *customFont = [UIFont fontWithName:fontName size:fontSize];
|
|
|
+ if(!customFont){
|
|
|
+ customFont = [MOSystemNormalCellData MODisplayFontWithSize:fontSize bold:YES itatic:NO weight:UIFontWeightMedium];
|
|
|
+ }
|
|
|
+ return customFont;
|
|
|
+}
|
|
|
+
|
|
|
++ (UIFont *)MODisplayFontWithSize:(CGFloat)fontSize
|
|
|
+ bold:(BOOL)bold itatic:(BOOL)italic weight:(UIFontWeight)weight {
|
|
|
+
|
|
|
+ UIFont *font = [UIFont systemFontOfSize:fontSize weight:weight];
|
|
|
+ UIFontDescriptorSymbolicTraits symbolicTraits = 0;
|
|
|
+ if (italic) {
|
|
|
+ symbolicTraits |= UIFontDescriptorTraitItalic;
|
|
|
+ }
|
|
|
+ if (bold) {
|
|
|
+ symbolicTraits |= UIFontDescriptorTraitBold;
|
|
|
+ }
|
|
|
+ UIFont *specialFont = [UIFont fontWithDescriptor:[[font fontDescriptor] fontDescriptorWithSymbolicTraits:symbolicTraits] size:font.pointSize];
|
|
|
+ return specialFont;
|
|
|
+}
|
|
|
+
|
|
|
@end
|