口袋优选

KBPopRouleView.m 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // KBPopRouleView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/10/15.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBPopRouleView.h"
  9. @implementation KBPopRouleView
  10. - (instancetype)initWithFrame:(CGRect)frame text:(NSString *)text {
  11. self = [super initWithFrame:frame];
  12. if (self) {
  13. self.layer.cornerRadius = Fitsize(8);
  14. self.backgroundColor = [UIColor whiteColor];
  15. UIImageView *icon = [[UIImageView alloc] initWithFrame:CGRectMake(0, -Fitsize(90), Fitsize(241), Fitsize(241))];
  16. icon.contentMode = UIViewContentModeScaleAspectFill;
  17. icon.centerX = self.width/2;
  18. icon.image = [UIImage imageNamed:@"sign_roule"];
  19. [self addSubview:icon];
  20. UILabel *des = [[UILabel alloc] initWithFrame:CGRectMake(10, Fitsize(130), self.width-20, Fitsize(200))];
  21. des.numberOfLines = 0;
  22. des.textColor = [UIColor YHColorWithHex:0x2A2A2A];
  23. des.font = [UIFont systemFontOfSize:Fitsize(14)];
  24. des.text = text;
  25. [des sizeToFit];
  26. des.centerX = self.width/2;
  27. des.textAlignment = NSTextAlignmentCenter;
  28. des.y = Fitsize(130);
  29. [self addSubview:des];
  30. }
  31. return self;
  32. }
  33. @end