口袋优选

KBSignSuccView.m 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // KBSignSuccView.m
  3. // YouHuiProject
  4. //
  5. // Created by 小花 on 2018/9/28.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KBSignSuccView.h"
  9. @implementation KBSignSuccView
  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(100), Fitsize(240), 240)];
  16. icon.contentMode = UIViewContentModeScaleAspectFill;
  17. icon.centerX = self.width/2;
  18. icon.image = [UIImage imageNamed:@"sign_succ"];
  19. [self addSubview:icon];
  20. UILabel *des = [[UILabel alloc] initWithFrame:CGRectMake(Fitsize(60), Fitsize(200), self.width-Fitsize(120), Fitsize(100))];
  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.y = Fitsize(150);
  27. [self addSubview:des];
  28. UIButton *sureBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, des.bottom+Fitsize(40), Fitsize(158), Fitsize(37))];
  29. sureBtn.layer.borderWidth = 1;
  30. sureBtn.layer.borderColor = [UIColor homeRedColor].CGColor;
  31. sureBtn.layer.cornerRadius = Fitsize(18);
  32. [sureBtn addTarget:self action:@selector(sureClickAction) forControlEvents:UIControlEventTouchUpInside];
  33. [sureBtn setTitle:@"知道了" forState:UIControlStateNormal];
  34. sureBtn.centerX = self.width/2;
  35. [sureBtn setTitleColor:[UIColor homeRedColor] forState:UIControlStateNormal];
  36. sureBtn.titleLabel.font = [UIFont systemFontOfSize:Fitsize(16)];
  37. [self addSubview:sureBtn];
  38. }
  39. return self;
  40. }
  41. - (void)sureClickAction {
  42. if (self.sureClick) {
  43. self.sureClick();
  44. }
  45. }
  46. @end