NewRollButtonCell.m 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // NewRollButtonCell.m
  3. // MingMen
  4. //
  5. // Created by 罗云飞 on 2017/5/14.
  6. // Copyright © 2017年 罗云飞. All rights reserved.
  7. //
  8. #import "NewRollButtonCell.h"
  9. @implementation NewRollButtonCell
  10. - (id)initWithFrame:(CGRect)frame
  11. {
  12. self = [super initWithFrame:frame];
  13. if (self) {
  14. [self.contentView setBackgroundColor:[UIColor clearColor]];
  15. self.img = [[UIImageView alloc] init];
  16. self.img.frame = CGRectMake((self.frame.size.width-fitScreenHeight(33))/2, (self.frame.size.height/2)-(fitScreenHeight(33)/2)-(fitScreenHeight(20)/2)-1.5, fitScreenHeight(33), fitScreenHeight(33));
  17. [self addSubview:self.img];
  18. self.tilte = [[UILabel alloc]init];
  19. self.tilte.frame = CGRectMake(0, self.img.frame.origin.y+self.img.frame.size.height+3, self.frame.size.width, fitScreenHeight(20));
  20. self.tilte.font = NewFont(12);
  21. self.tilte.textColor = NewBlackColor;
  22. self.tilte.textAlignment = NSTextAlignmentCenter;
  23. [self addSubview:self.tilte];
  24. }
  25. return self;
  26. }
  27. - (void)assignment:(NSDictionary *)model type:(NewRollButtonType)type
  28. {
  29. if (type == rollButtonAndTitle) {
  30. [self.img sd_setImageWithURL:NewURL([model safeObjectForKey:@"classifyIcon"]) placeholderImage:NewImageError_C];
  31. self.tilte.text = [model safeObjectForKey:@"classifyName"];
  32. }else {
  33. [self.img sd_setImageWithURL:NewURL([model safeObjectForKey:@"classifyIcon"]) placeholderImage:NewImageError_C];
  34. self.tilte.hidden = YES;
  35. }
  36. }
  37. @end