DailyQuestCell.m 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // DailyQuestCell.m
  3. // PopupViewWindow
  4. //
  5. // Created by 杨仁伟 on 2017/5/22.
  6. // Copyright © 2017年 yrw. All rights reserved.
  7. //
  8. #import "DailyQuestCell.h"
  9. #import "BMListModel.h"
  10. @implementation DailyQuestCell
  11. - (void)awakeFromNib
  12. {
  13. [super awakeFromNib];
  14. // self.img.hidden = YES;
  15. self.imgTitleL.numberOfLines = 0;
  16. self.imgTitleL.textAlignment = NSTextAlignmentCenter;
  17. }
  18. - (void)layoutSubviews
  19. {
  20. [super layoutSubviews];
  21. // self.distanceTopConstant.constant = self.distanceTopConstant.constant * kAppRowHScale;
  22. // self.imgDistanceTopConstant.constant = self.imgDistanceTopConstant.constant * kAppRowHScale;
  23. // self.receiveBtnWConstant.constant = self.receiveBtnWConstant.constant * kScaleWidth;
  24. // self.receiveBtnHconstant.constant = self.receiveBtnHconstant.constant * kAppRowHScale;
  25. // self.receiveBtn.layer.cornerRadius = 3;
  26. self.viewVideoLbl.font = [UIFont systemFontOfSize:15];
  27. // self.viewVideoLbl.textColor = kAppGrayColor1;
  28. // self.rewardLbl.textColor = RGB(255, 95, 95);
  29. self.rewardLbl.font = [UIFont systemFontOfSize:13];
  30. }
  31. - (void)configDailyQuestWithImgArray:(NSMutableArray *)imgArray taskArray:(NSMutableArray *)taskArray currentIndexPath:(NSInteger)currentIndexPath
  32. {
  33. // self.img.image = [UIImage imageNamed:imgArray[currentIndexPath]];
  34. self.viewVideoLbl.text = taskArray[currentIndexPath];
  35. }
  36. - (void)creatCellWithModel:(BMListModel *)listModel andRow:(int)row
  37. {
  38. // [self.img sd_setImageWithURL:[NSURL URLWithString:listModel.image] placeholderImage:kDefaultPreloadHeadImg];
  39. self.viewVideoLbl.text = listModel.title;
  40. self.rewardLbl.text = listModel.desc;
  41. self.receiveBtn.tag = row;
  42. self.imgTitleL.text = listModel.title;
  43. if ([listModel.left_times intValue] == 0)
  44. {
  45. // self.receiveBtn.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
  46. // self.receiveBtn.layer.cornerRadius = 3;
  47. self.receiveBtn.contentHorizontalAlignment=UIControlContentHorizontalAlignmentCenter;
  48. self.receiveBtn.userInteractionEnabled = NO;
  49. [self.receiveBtn setTitle:ASLocalizedString(@"已领")forState:UIControlStateNormal];
  50. [self.receiveBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
  51. }else
  52. {
  53. if ([listModel.progress intValue] == 100)
  54. {
  55. self.receiveBtn.userInteractionEnabled = YES;
  56. self.receiveBtn.backgroundColor = kClearColor;
  57. self.receiveBtn.contentHorizontalAlignment=UIControlContentHorizontalAlignmentCenter;
  58. [self.receiveBtn setTitle:ASLocalizedString(@"领取")forState:UIControlStateNormal];
  59. [self.receiveBtn setBackgroundImage:[UIImage imageNamed:@"mg_daily_task_receive"] forState:UIControlStateNormal];
  60. }else
  61. {
  62. [self.receiveBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
  63. self.receiveBtn.backgroundColor = kClearColor;
  64. [self.receiveBtn setBackgroundImage:[UIImage imageNamed:@"mg_daily_task_receive_select"] forState:UIControlStateNormal];
  65. [self.receiveBtn setTitle:[NSString stringWithFormat:@"%@/%@",listModel.current,listModel.target] forState:UIControlStateNormal];
  66. self.receiveBtn.userInteractionEnabled = NO;
  67. }
  68. }
  69. }
  70. - (IBAction)receiveBtn:(UIButton *)sender
  71. {
  72. if (self.taskBlock)
  73. {
  74. self.taskBlock((int)sender.tag);
  75. }
  76. }
  77. @end