酷店

KDPServiceView.m 3.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // KDPServiceView.m
  3. // KuDianProject
  4. //
  5. // Created by 学丽 on 2019/7/12.
  6. // Copyright © 2019 KDP. All rights reserved.
  7. //
  8. #import "KDPServiceView.h"
  9. @implementation KDPServiceView
  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.4];
  15. UIView *backV=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 281, 286)];
  16. backV.backgroundColor=[UIColor whiteColor];
  17. backV.layer.cornerRadius=9;
  18. backV.layer.masksToBounds=YES;
  19. [self addSubview:backV];
  20. backV.center=self.center;
  21. UIImageView *imgv=[[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2-32, backV.top-32, 64, 64)];
  22. imgv.image=[UIImage imageNamed:@"serviece_icon"];
  23. [self addSubview:imgv];
  24. UILabel *label =[[UILabel alloc]initWithFrame:CGRectMake(0, 54, backV.width, 25)];
  25. label.textAlignment=NSTextAlignmentCenter;
  26. label.text=@"使用酷店的三个步骤:";
  27. label.textColor=[UIColor colorWithHexString:fontColor];
  28. label.font=[UIFont systemFontOfSize:18];
  29. [backV addSubview:label];
  30. UILabel *contentL=[[UILabel alloc]initWithFrame:CGRectMake(69, label.bottom+21, 150, 75)];
  31. contentL.font=[UIFont systemFontOfSize:15];
  32. contentL.numberOfLines=3;
  33. contentL.textAlignment=NSTextAlignmentCenter;
  34. contentL.textColor=[UIColor colorWithHexString:fontColor];
  35. [backV addSubview:contentL];
  36. NSString *contentstr=@"① 绑定快手小店Pid\n② 将商品推广到快手\n③ 查看订单和收益";
  37. NSMutableAttributedString * attributedString1 = [[NSMutableAttributedString alloc] initWithString:contentstr];
  38. NSMutableParagraphStyle * paragraphStyle1 = [[NSMutableParagraphStyle alloc] init];
  39. [paragraphStyle1 setLineSpacing:8];
  40. [attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [contentstr length])];
  41. [contentL setAttributedText:attributedString1];
  42. UIButton *buyButton=[[UIButton alloc]initWithFrame:CGRectMake(26, contentL.bottom+26, 230, 43)];
  43. buyButton.layer.cornerRadius=21.5;
  44. buyButton.layer.masksToBounds=YES;
  45. [backV addSubview:buyButton];
  46. buyButton.backgroundColor=[UIColor colorWithHexString:ThemeColor];
  47. buyButton.titleLabel.font=[UIFont systemFontOfSize:14];
  48. [buyButton setTitle:@"了解更多" forState:UIControlStateNormal];
  49. [backV addSubview:buyButton];
  50. [buyButton addTarget:self action:@selector(clickTBBtuuton) forControlEvents:UIControlEventTouchUpInside];
  51. UIButton *kwaiBtn=[[UIButton alloc]initWithFrame:CGRectMake(26, buyButton.bottom+10, 230, 20)];
  52. [kwaiBtn setTitle:@"跳过" forState:UIControlStateNormal];
  53. kwaiBtn.titleLabel.font=[UIFont systemFontOfSize:14];
  54. [kwaiBtn setTitleColor:[UIColor colorWithHexString:@"#666666"] forState:UIControlStateNormal];
  55. [backV addSubview:kwaiBtn];
  56. [kwaiBtn addTarget:self action:@selector(cancelButton) forControlEvents:UIControlEventTouchUpInside];
  57. }
  58. return self;
  59. }
  60. -(void)cancelButton
  61. {
  62. [self removeFromSuperview];
  63. }
  64. -(void)clickTBBtuuton
  65. {
  66. if (self.serviceBlock) {
  67. self.serviceBlock();
  68. }
  69. }
  70. -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
  71. {
  72. [self removeFromSuperview];
  73. }
  74. @end