//
//  GalleryCollectionViewCell.m
//  CapitalChamberlain
//
//  Created by 张杰 on 15/12/3.
//  Copyright © 2015年 SunShine. All rights reserved.
//

#import "GalleryCollectionViewCell.h"
#import "ZJBaseFileModel.h"
@interface GalleryCollectionViewCell ()
@property (nonatomic, strong) SingleScrollView *imageScrollView;
@end
@implementation GalleryCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    CLog(@"%f",self.width);
    self.imageScrollView = [[SingleScrollView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight)];
    self.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:self.imageScrollView];
}

- (void)cellWithImgName:(NSString *)imgUrl {
    
}

- (void)configCellWithArray:(NSMutableArray *)array indexPath:(NSIndexPath *)indexPath {
    ZJBaseFileModel *model = array[indexPath.row];
    
    if ([model isKindOfClass:[ZJBaseFileModel class]]) {
        if (model.image != nil) {
            [self.imageScrollView setImage:model.image placeHolder:kPlaceHolderImage];
        }else{
            WS(weakSelf);
            [model getFileUrlComplelet:^(NSString *fileUrl) {
                [weakSelf.imageScrollView setImage:fileUrl placeHolder:kPlaceHolderImage];
            }];
        }
    }else if([model isKindOfClass:[UIImage class]]){
        [self.imageScrollView setImage:model placeHolder:kPlaceHolderImage];
    }
}

@end
