CNLiveMineModel.m
1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// CNLiveMineModel.m
// CNLiveMineModule
//
// Created by 153993236@qq.com on 11/12/2019.
// Copyright © 2019 153993236@qq.com. All rights reserved.
//
#import "CNLiveMineModel.h"
@implementation CNLiveMineModel
static const NSInteger margin = 10;
+ (NSDictionary *)mj_objectClassInArray{
return @{
@"buttons" : @"CNLiveMineButtonModel"
};
}
- (void)editModel:(BOOL)showMapTool{
if ([self.style isEqualToString:@"2"]) {
NSMutableArray *array = [NSMutableArray arrayWithArray:self.buttons];
if (!showMapTool) {
[array removeLastObject];
self.buttons = [NSArray arrayWithArray:array];
}
}
}
- (CNLiveMineCellType)type{
if([self.style isEqualToString:@"1"]){
return CNLiveMineCellTypeOrder;
}
else if([self.style isEqualToString:@"2"]){
return CNLiveMineCellTypeTool;
}
else if([self.style isEqualToString:@"3"]){
return CNLiveMineCellTypeGoods;
}
else if([self.style isEqualToString:@"4"]){
return CNLiveMineCellTypeSports;
}
return CNLiveMineCellTypeOrder;
}
- (CGFloat)height{
CGFloat titleHeight = 50;
CGFloat btnHeight = 60;
//订单
if(self.type == CNLiveMineCellTypeOrder){
return 2*margin+titleHeight+btnHeight+margin;
}
//工具
else if(self.type == CNLiveMineCellTypeTool){
return 2*margin+titleHeight+ceilf(self.buttons.count/4.0)*(btnHeight+margin);
}
//商品
else if(self.type == CNLiveMineCellTypeGoods){
// 电票的高度 80
return 2*margin+titleHeight+80+margin;
}
//大众体育
else if(self.type == CNLiveMineCellTypeSports){
return 2*margin+titleHeight+ceilf(self.buttons.count/4.0)*(btnHeight+margin);
}
return 0.0000001f;
}
@end
@implementation CNLiveMineButtonModel
@end