//
//  FooterView.m
//  Open
//
//  Created by 雷俊博 on 2020/7/27.
//  Copyright © 2020 黄江涛 . All rights reserved.
//

#import "FooterView.h"
#import "SecurityCell.h"

@interface FooterView ()<UICollectionViewDelegate,UICollectionViewDataSource>

@property (unsafe_unretained, nonatomic) IBOutlet UICollectionView *collectionView;

@property (nonatomic, strong)NSArray* images;

@property (nonatomic, strong)NSArray* titleArray;

@property (nonatomic, strong)NSArray* titleArray2;

@property (nonatomic, strong)NSArray* titleArray3;


@end

@implementation FooterView
- (void)awakeFromNib {
    [super awakeFromNib];
    [self.collectionView registerNib:[UINib nibWithNibName:@"SecurityCell" bundle:nil] forCellWithReuseIdentifier:@"cell"];
}
#pragma mark - UICollectionViewDataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return 3;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    SecurityCell*cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    
    cell.icon.image = [UIImage imageNamed:self.images[indexPath.row]];
    
    cell.lb1.text = self.titleArray[indexPath.row];
    
    cell.lb2.text = self.titleArray2[indexPath.row];
    
    cell.lb3.text = self.titleArray3[indexPath.row];
    
    
    return cell;
}

/**
 cell的大小
 */
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    return CGSizeMake(ScreenWidth/3, 151);
    
}

/**
 每个分区的内边距（上左下右）
 */
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{

    return UIEdgeInsetsMake(0, 0, 0, 0);
}


/**
 分区内cell之间的最小行间距
 */
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
    return 0.0;
}
/**
 分区内cell之间的最小列间距
 */
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
    return 0.0;
}

#pragma mark - getters
- (NSArray *)images
{
    if (!_images) {
        _images = @[@"save_security",@"saveService",@"saveguarantee2"];
    }
    return _images;
}

- (NSArray *)titleArray
{
    if (!_titleArray) {
        _titleArray = @[@"安全",@"服务",@"保障"];
    }
    return _titleArray;
}

- (NSArray *)titleArray2
{
    if (!_titleArray2) {
        _titleArray2 = @[@"银行存款",@"专业赋能下沉市场",@"五十万内存款"];
    }
    return _titleArray2;
}

- (NSArray *)titleArray3
{
    if (!_titleArray3) {
        _titleArray3 = @[@"安全合规",@"服务用户3000万+",@"国家法定赔偿"];
    }
    return _titleArray3;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
