34 lines
1.2 KiB
Objective-C
34 lines
1.2 KiB
Objective-C
//
|
|
// PushmessageModel.m
|
|
// Ifish
|
|
//
|
|
// Created by imac on 16/3/30.
|
|
// Copyright © 2016年 imac. All rights reserved.
|
|
//
|
|
|
|
#import "PushmessageModel.h"
|
|
|
|
@implementation PushmessageModel
|
|
//获取cell高度
|
|
-(void)getCellHeight{
|
|
|
|
NSString *contentStr = self.pushContext;
|
|
|
|
NSMutableParagraphStyle *paraStyle = [[NSMutableParagraphStyle alloc] init];
|
|
paraStyle.lineBreakMode = NSLineBreakByCharWrapping;
|
|
paraStyle.alignment = NSTextAlignmentLeft;
|
|
//获得带有行间距为2的高度
|
|
paraStyle.lineSpacing = kSizeFrom750(8);
|
|
paraStyle.hyphenationFactor = 1.0;
|
|
paraStyle.firstLineHeadIndent = 0.0;
|
|
paraStyle.paragraphSpacingBefore = 0.0;
|
|
paraStyle.headIndent = 0;
|
|
paraStyle.tailIndent = 0;
|
|
//字间距为0
|
|
NSDictionary *dic = @{NSFontAttributeName:SYSTEMSIZE(28), NSParagraphStyleAttributeName:paraStyle, NSKernAttributeName:@0.f
|
|
};
|
|
CGSize size = [contentStr boundingRectWithSize:CGSizeMake(kSizeFrom750(576), 999.f) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading|NSStringDrawingTruncatesLastVisibleLine attributes:dic context:nil].size;
|
|
self.cellHeight = size.height+kSizeFrom750(120);
|
|
}
|
|
@end
|