PrizeExchangeInformationTableViewCell.m 1.17 KB
Newer Older
1 2 3 4 5 6 7 8 9
//
//  PrizeExchangeInformationTableViewCell.m
//  Lighting
//
//  Created by 曹云霄 on 2016/11/22.
//  Copyright © 2016年 上海勾芒科技有限公司. All rights reserved.
//

#import "PrizeExchangeInformationTableViewCell.h"
10
#import "GiftInformationView.h"
11 12 13 14 15 16 17 18

@implementation PrizeExchangeInformationTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
}


19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
- (void)setGiftDetailsArray:(NSArray<TOPrizeBillDetailsEntity> *)giftDetailsArray
{
    for (UIView *view in self.contentView.subviews) {
        [view removeFromSuperview];
    }
    _giftDetailsArray = giftDetailsArray;
    CGFloat itemHeight = 100;
    CGFloat tandemInterval = 20;
    CGFloat horizontalInterval = 300;
    for (int i=0; i<_giftDetailsArray.count; i++) {
        TOPrizeBillDetailsEntity *entity = _giftDetailsArray[i];
        GiftInformationView *giftView = [[GiftInformationView alloc] initWithializeGiftView:entity.prize.picture withGiftName:entity.prize.name];
        giftView.frame = CGRectMake((i%2)*(itemHeight+horizontalInterval)+itemHeight/2, (i/2)*(itemHeight+tandemInterval)+tandemInterval, horizontalInterval, itemHeight);
        [self.contentView addSubview:giftView];
    }
34 35
}

36

37
@end