dkahgld

ZBUseStep.m 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. //
  2. // ZBUseStep.m
  3. // ZBProject
  4. //
  5. // Created by 学丽 on 2019/4/11.
  6. // Copyright © 2019 ZB. All rights reserved.
  7. //
  8. #import "ZBUseStep.h"
  9. @implementation ZBUseStep
  10. -(instancetype)initWithFrame:(CGRect)frame
  11. {
  12. self =[super initWithFrame:frame];
  13. if (self) {
  14. self.backgroundColor=[UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.5];
  15. UIView *backV =[[UIView alloc]init];
  16. backV.backgroundColor=[UIColor whiteColor];
  17. backV.layer.cornerRadius=9;
  18. backV.layer.masksToBounds=YES;
  19. [self addSubview:backV];
  20. UIImageView *headIm =[[UIImageView alloc]init];
  21. [headIm setImage:[UIImage imageNamed:@"kefu_head"]];
  22. headIm.layer.cornerRadius=32.5;
  23. headIm.layer.masksToBounds=YES;
  24. [self addSubview:headIm];
  25. [headIm mas_makeConstraints:^(MASConstraintMaker *make) {
  26. make.width.height.mas_equalTo(65);
  27. make.centerX.mas_equalTo(backV.mas_centerX);
  28. make.top.mas_equalTo(backV.mas_top).offset(-32.5);
  29. }];
  30. [backV mas_makeConstraints:^(MASConstraintMaker *make) {
  31. make.width.mas_equalTo(281);
  32. make.height.mas_equalTo(286);
  33. make.centerX.mas_equalTo(self.centerX);
  34. make.centerY.mas_equalTo(self.centerY);
  35. }];
  36. [backV addSubview:self.titleLabel];
  37. [backV addSubview:self.contentLabel];
  38. [backV addSubview:self.okBtn];
  39. [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.top.mas_equalTo(headIm.mas_bottom).offset(22);
  41. make.height.mas_equalTo(34);
  42. make.left.mas_equalTo(10);
  43. make.right.mas_equalTo(-10);
  44. }];
  45. [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  46. make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(14);
  47. make.left.mas_equalTo(70);
  48. make.right.mas_equalTo(-70);
  49. }];
  50. [self.okBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  51. make.left.mas_equalTo(26);
  52. make.height.mas_equalTo(43);
  53. make.top.mas_equalTo(self.contentLabel.mas_bottom).offset(25);
  54. make.right.mas_equalTo(-25);
  55. }];
  56. UIButton *skipBtn=[[UIButton alloc]init];
  57. [backV addSubview:skipBtn];
  58. [skipBtn setTitle:@"跳过" forState:UIControlStateNormal];
  59. [skipBtn setTitleColor:[UIColor YHColorWithHex:0xB7B7B7] forState:UIControlStateNormal];
  60. skipBtn.titleLabel.font=[UIFont systemFontOfSize:16];
  61. [skipBtn addTarget:self action:@selector(skipClickBtn) forControlEvents:UIControlEventTouchUpInside];
  62. [skipBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  63. make.left.mas_equalTo(26);
  64. make.height.mas_equalTo(33);
  65. make.top.mas_equalTo(self.okBtn.mas_bottom).offset(5);
  66. make.right.mas_equalTo(-25);
  67. }];
  68. }
  69. return self;
  70. }
  71. -(void)skipClickBtn
  72. {
  73. [self removeFromSuperview];
  74. }
  75. -(UILabel *)titleLabel
  76. {
  77. if (!_titleLabel ) {
  78. _titleLabel=[[UILabel alloc]init];
  79. _titleLabel.textColor=[UIColor YHColorWithHex:0x333333];
  80. _titleLabel.font=[UIFont boldSystemFontOfSize:18];
  81. _titleLabel.textAlignment=NSTextAlignmentCenter;
  82. _titleLabel.text=@"使用酷店的三个步骤:";
  83. }
  84. return _titleLabel;
  85. }
  86. -(UILabel *)contentLabel
  87. {
  88. if (!_contentLabel) {
  89. _contentLabel=[[UILabel alloc]init];
  90. _contentLabel.textColor=[UIColor YHColorWithHex:0x333333];
  91. _contentLabel.font=[UIFont systemFontOfSize:14];
  92. _contentLabel.numberOfLines=0;
  93. NSString *str=@"① 绑定快手小店Pid \n② 将商品推广到快手\n③ 查看订单和收益";
  94. NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:str];
  95. NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
  96. [paragraphStyle1 setLineSpacing:8];
  97. [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [str length])];
  98. [_contentLabel setAttributedText:attributedString1];
  99. [_contentLabel sizeToFit];
  100. }
  101. return _contentLabel;
  102. }
  103. -(UIButton *)okBtn
  104. {
  105. if (!_okBtn) {
  106. _okBtn =[[UIButton alloc]init];
  107. [_okBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  108. _okBtn.titleLabel.font=[UIFont systemFontOfSize:15];
  109. _okBtn.layer.cornerRadius=21.5;
  110. _okBtn.layer.masksToBounds=YES;
  111. _okBtn.backgroundColor=[UIColor gradientWidthFromColor:[UIColor YHColorWithHex:0xFF8300] toColor:[UIColor YHColorWithHex:0xFF5200] withWidth:230];
  112. [_okBtn setTitle:@"了解更多" forState:UIControlStateNormal];
  113. [_okBtn addTarget:self action:@selector(clickOpentb) forControlEvents:UIControlEventTouchUpInside];
  114. }
  115. return _okBtn;
  116. }
  117. -(void)clickOpentb
  118. {
  119. if (self.stepBlock) {
  120. self.stepBlock();
  121. }
  122. [self removeFromSuperview];
  123. }
  124. @end