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
//
// PicViewModel.m
// RealEstateManagement
//
// Created by Javen on 2017/1/6.
// Copyright © 2017年 上海勾芒信息科技. All rights reserved.
//
#import "PicViewModel.h"
@implementation PicViewModel
/**
获取cell的高度
@return 高度
*/
- (CGFloat)cellHeight {
NSInteger picCount = self.arrPics.count;
//如果非只读的情况,则还需要多计算一个添加按钮的位置
if (self.type != kPicCellTypeRead) {
if (self.arrPics.count != kMaxAddRepairImgNumber) {
picCount += 1;
}
}
NSInteger div = picCount / 2;
NSInteger remainder = picCount % 2;
if (remainder != 0) {
div = div + 1;
}
return div * (kPicCellSize.height + 20);
}
- (NSMutableArray *)arrPics {
if (!_arrPics) {
_arrPics = [NSMutableArray array];
}
return _arrPics;
}
@end