|
@@ -59,7 +59,7 @@
|
|
paragraphStyle.maximumLineHeight = 21;
|
|
paragraphStyle.maximumLineHeight = 21;
|
|
paragraphStyle.minimumLineHeight = 21;
|
|
paragraphStyle.minimumLineHeight = 21;
|
|
UIFont *font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
|
|
UIFont *font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
|
|
- CGFloat baseLineOffset = (21 - font.lineHeight) / 4;
|
|
|
|
|
|
+ CGFloat baseLineOffset = [GroupNoticeCell getBaseOffline:font lineHeight:21];
|
|
NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:model.content attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:font, NSForegroundColorAttributeName:HexRGB(0x777777), NSBaselineOffsetAttributeName:@(baseLineOffset)}];
|
|
NSMutableAttributedString *attrs = [[NSMutableAttributedString alloc] initWithString:model.content attributes:@{NSParagraphStyleAttributeName:paragraphStyle,NSFontAttributeName:font, NSForegroundColorAttributeName:HexRGB(0x777777), NSBaselineOffsetAttributeName:@(baseLineOffset)}];
|
|
self.noticeContent.attributedText = attrs;
|
|
self.noticeContent.attributedText = attrs;
|
|
}
|
|
}
|
|
@@ -71,6 +71,14 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
++ (CGFloat)getBaseOffline:(UIFont *)font lineHeight:(CGFloat)lineHeight {
|
|
|
|
+ CGFloat descender = fabs(font.descender); // descender 为负值,取绝对值
|
|
|
|
+ CGFloat ascender = font.ascender;
|
|
|
|
+ CGFloat fontHeight = ascender + descender;
|
|
|
|
+ CGFloat offset = (lineHeight - fontHeight) / 2.0; // 假设上下均等分布
|
|
|
|
+ return offset;
|
|
|
|
+}
|
|
|
|
+
|
|
- (IBAction)editAction:(UIButton *)sender {
|
|
- (IBAction)editAction:(UIButton *)sender {
|
|
if (self.callback) {
|
|
if (self.callback) {
|
|
self.callback(self.sourceModel,sender);
|
|
self.callback(self.sourceModel,sender);
|