PicViewModel.m 865 Bytes
//
//  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