| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- //
- // OneSectionTableViewCell.m
- // BuguLive
- //
- // Created by fanwe2014 on 16/8/5.
- // Copyright © 2016年 xfg. All rights reserved.
- #import "OneSectionTableViewCell.h"
- #import "AcutionDetailModel.h"
- @implementation OneSectionTableViewCell
- - (void)awakeFromNib
- {
- [super awakeFromNib];
- //设定时分秒的背景
- self.auctionButton.layer.cornerRadius = self.auctionButton.frame.size.height/2;
- self.backgroundColor = kAppMainColor;
-
- self.timeLabel.textColor = self.maoHaoLabel2.textColor = self.maoHaoLabel.textColor = kAppGrayColor1;
-
- self.minuteLabel.textColor = self.secLabel.textColor = self.hourLabel.textColor = kWhiteColor;
-
- self.auctionButton = [UIButton buttonWithType:UIButtonTypeCustom];
- self.auctionButton.titleLabel.font = [UIFont systemFontOfSize:12];
- [self.auctionButton setTitle:ASLocalizedString(@"竞拍结束")forState:0];
- [self addSubview:self.auctionButton];
-
- }
- - (void)creatCellWithArray:(NSMutableArray *)array andStatue:(int)statue
- {
- AcutionDetailModel *ADModel = array[0];
- if (statue == 0)//0竞拍中 1竞拍成功 2流拍 3失败
- {
- self.auctionImgView.hidden = YES;
- self.auctionButton.hidden = YES;
- self.auctionLabel.hidden = YES;
-
- self.rightImgView.hidden = NO;
- self.priceLabel.hidden = NO;
- self.timeLabel.hidden = NO;
- self.hourLabel.hidden = NO;
- self.minuteLabel.hidden = NO;
- self.secLabel.hidden = NO;
- self.goldImgView.hidden = NO;
- self.nowPriceLabel.hidden = NO;
- self.remainTimeLabel.hidden = NO;
- self.maoHaoLabel.hidden = NO;
- self.maoHaoLabel2.hidden = NO;
- self.priceLabel.text = ADModel.info.last_pai_diamonds;
-
- }else
- {
- self.auctionImgView.hidden = NO;
- self.auctionButton.hidden = NO;
- self.auctionLabel.hidden = NO;
-
- self.rightImgView.hidden = YES;
- self.priceLabel.hidden = YES;
- self.timeLabel.hidden = YES;
- self.hourLabel.hidden = YES;
- self.minuteLabel.hidden = YES;
- self.secLabel.hidden = YES;
- self.goldImgView.hidden = YES;
- self.nowPriceLabel.hidden = YES;
- self.remainTimeLabel.hidden = YES;
- self.maoHaoLabel.hidden = YES;
- self.maoHaoLabel2.hidden = YES;
- if (statue == 1)
- {
- self.backImgView.backgroundColor = kAppMainColor;
- self.auctionImgView.image = [UIImage imageNamed:@"ac_success"];
-
- NSString *string = ASLocalizedString(@"竞拍成功");
- NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:string];
- [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:20.0]} range:NSMakeRange(0, string.length)];
- CGFloat width =[string sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20]}].width;
- self.auctionLabel.frame = CGRectMake(self.auctionImgView.frame.size.width+self.auctionImgView.frame.origin.x+5,16,width, 20);
- self.auctionLabel.attributedText = attr;
- self.auctionButton.frame = CGRectMake(self.auctionLabel.frame.size.width+self.auctionLabel.frame.origin.x+5,16,65 ,20);
- self.auctionButton.backgroundColor = kYellowColor;
- [self.auctionButton setTitleColor:kAppMainColor forState:0];
- [self.auctionButton setTitle:ASLocalizedString(@"结算中")forState:0];
-
-
- }else if (statue == 2)
- {
- self.backImgView.backgroundColor = kAppGrayColor6;
- self.auctionImgView.image = [UIImage imageNamed:@"ac_fail"];
-
- NSString *string = ASLocalizedString(@"流拍");
- NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:string];
- [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:20.0]} range:NSMakeRange(0, string.length)];
- CGFloat width =[string sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20]}].width;
- self.auctionLabel.frame = CGRectMake(self.auctionImgView.frame.size.width+self.auctionImgView.frame.origin.x+5,16,width, 20);
- self.auctionLabel.attributedText = attr;
- CGRect rect = self.auctionButton.frame;
- rect = CGRectMake(self.auctionLabel.frame.size.width+self.auctionLabel.frame.origin.x+5,16,65 ,20);
- self.auctionButton.frame = rect;
- self.auctionButton.backgroundColor = kAppGrayColor7;
- [self.auctionButton setTitleColor:kWhiteColor forState:0];
-
- }else if (statue == 3)
- {
- self.backImgView.backgroundColor = kAppGrayColor6;
- self.auctionImgView.image = [UIImage imageNamed:@"ac_fail"];
-
- NSString *string = ASLocalizedString(@"竞拍失败");
- NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:string];
- [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:20.0]} range:NSMakeRange(0, string.length)];
- CGFloat width =[string sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20]}].width;
- self.auctionLabel.frame = CGRectMake(self.auctionImgView.frame.size.width+self.auctionImgView.frame.origin.x+5,16,width, 20);
- self.auctionLabel.attributedText = attr;
- self.auctionButton.frame = CGRectMake(self.auctionLabel.frame.size.width+self.auctionLabel.frame.origin.x+5,16,90 ,20);
- [self.auctionButton setTitle:ASLocalizedString(@"主播关闭竞拍")forState:0];
- self.auctionButton.backgroundColor = kAppGrayColor7;
- [self.auctionButton setTitleColor:kWhiteColor forState:0];
-
- }else if (statue == 4)
- {
- self.backImgView.backgroundColor = kAppMainColor;
- self.auctionImgView.image = [UIImage imageNamed:@"ac_success"];
-
- NSString *string = ASLocalizedString(@"竞拍成功");
- NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:string];
- [attr setAttributes:@{NSFontAttributeName : [UIFont systemFontOfSize:20.0]} range:NSMakeRange(0, string.length)];
- CGFloat width =[string sizeWithAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20]}].width;
- self.auctionLabel.frame = CGRectMake(self.auctionImgView.frame.size.width+self.auctionImgView.frame.origin.x+5,16,width, 20);
- self.auctionLabel.attributedText = attr;
- self.auctionButton.frame = CGRectMake(self.auctionLabel.frame.size.width+self.auctionLabel.frame.origin.x+5,16,65 ,20);
- self.auctionButton.backgroundColor = kYellowColor;
- [self.auctionButton setTitleColor:kAppMainColor forState:0];
- [self.auctionButton setTitle:ASLocalizedString(@"竞拍结束")forState:0];
-
-
- }
- self.auctionButton.layer.cornerRadius = self.auctionButton.frame.size.height/2;
- }
-
-
- }
- @end
|