From 7b02207537d35bfa1714bf8beafc921f717d100a Mon Sep 17 00:00:00 2001 From: 单军华 Date: Wed, 11 Jul 2018 10:47:42 +0800 Subject: [PATCH] 首次上传 --- screendisplay/screendisplay/Classes/Base/BaseModels/LMJWordItem.m | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 52 insertions(+), 0 deletions(-) diff --git a/screendisplay/screendisplay/Classes/Base/BaseModels/LMJWordItem.m b/screendisplay/screendisplay/Classes/Base/BaseModels/LMJWordItem.m new file mode 100755 index 0000000..14f7120 --- /dev/null +++ b/screendisplay/screendisplay/Classes/Base/BaseModels/LMJWordItem.m @@ -0,0 +1,52 @@ +// +// LMJWordItem.m +// GoMeYWLC +// +// Created by NJHu on 2016/10/21. +// Copyright �� 2016��� NJHu. All rights reserved. +// + +#import "LMJWordItem.h" + +@implementation LMJWordItem + ++ (instancetype)itemWithTitle:(NSString *)title subTitle:(NSString *)subTitle +{ + LMJWordItem *item = [[self alloc] init]; + item.subTitle = subTitle; + item.title = title; + return item; +} + ++ (instancetype)itemWithTitle:(NSString *)title subTitle:(NSString *)subTitle itemOperation:(void(^)(NSIndexPath *indexPath))itemOperation { + LMJWordItem *item = [self itemWithTitle:title subTitle:subTitle]; + item.itemOperation = itemOperation; + return item; +} + +- (instancetype)init +{ + if (self = [super init]) { + _titleColor = [UIColor blackColor]; + _subTitleColor = [UIColor blackColor]; +// _cellHeight = AdaptedWidth(50); + _titleFont = AdaptedFontSize(16); + _subTitleFont = AdaptedFontSize(16); + } + + return self; +} + +- (CGFloat)cellHeight { + if (!_cellHeight) { + _cellHeight += 20; + NSString *totalString = [NSString stringWithFormat:@"%@%@", self.title, self.subTitle]; + _cellHeight += [totalString boundingRectWithSize:CGSizeMake(kScreenWidth - 20, MAXFLOAT) options:0 attributes:@{NSFontAttributeName : self.subTitleFont} context:nil].size.height; + _cellHeight = MAX(_cellHeight, 50); + _cellHeight = AdaptedWidth(_cellHeight); + } + return _cellHeight; +} + + +@end -- Gitblit v1.8.0