Nessuna descrizione

KXThirdMarkView.m 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //
  2. // KXThirdMarkView.m
  3. // CAISHEN
  4. //
  5. // Created by jikaipeng on 2018/5/21.
  6. // Copyright © 2018年 kuxuan. All rights reserved.
  7. //
  8. #import "KXThirdMarkView.h"
  9. @implementation KXThirdMarkView
  10. - (instancetype)initWithFrame:(CGRect)frame{
  11. if (self = [super initWithFrame:frame]) {
  12. [self setUpUI];
  13. }
  14. return self;
  15. }
  16. - (void)setUpUI{
  17. self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
  18. UIView *midView = [[UIView alloc] init];
  19. midView.backgroundColor = [UIColor whiteColor];
  20. midView.layer.cornerRadius = 12;
  21. midView.layer.masksToBounds = YES;
  22. [self addSubview:midView];
  23. UIImageView *imageView = [[UIImageView alloc] init];
  24. imageView.image = [UIImage imageNamed:@"main_mark_icon3.0"];
  25. [self addSubview:imageView];
  26. UILabel *titleLabel = [[UILabel alloc] init];
  27. titleLabel.textColor = [UIColor titleColor];
  28. titleLabel.font = FONT_SYS(14);
  29. titleLabel.text = @"悄悄告诉你";
  30. [midView addSubview:titleLabel];
  31. UILabel *detailLabel = [[UILabel alloc] init];
  32. detailLabel.textColor = [UIColor titleColor];
  33. detailLabel.font = [UIFont boldSystemFontOfSize:14];
  34. detailLabel.text = @"在应用商店评论可以加快放款速度哦";
  35. [midView addSubview:detailLabel];
  36. UIButton *appstoreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  37. NSDictionary *attibuteDict = @{NSForegroundColorAttributeName:[UIColor baseColor],NSFontAttributeName:FONT_SYS(18)};
  38. NSAttributedString *attibute = [[NSAttributedString alloc] initWithString:@"去评论" attributes:attibuteDict];
  39. appstoreBtn.tag = 1000;
  40. [appstoreBtn setAttributedTitle:attibute forState:UIControlStateNormal];
  41. [appstoreBtn addTarget:self.delegate action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
  42. [midView addSubview:appstoreBtn];
  43. UIView *lineView = [[UIView alloc] init];
  44. lineView.backgroundColor = [UIColor KXColorWithHex:0xdddddd];
  45. [midView addSubview:lineView];
  46. UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  47. [closeBtn setImage:[UIImage imageNamed:@"home_mark_cloese3.0"] forState:UIControlStateNormal];
  48. closeBtn.tag = 2000;
  49. [closeBtn addTarget:self.delegate action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
  50. [self addSubview:closeBtn];
  51. [midView mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.centerX.equalTo(self.mas_centerX);
  53. make.centerY.equalTo(self.mas_centerY);
  54. make.size.equalTo(CGSizeMake(Fitsize(272), Fitsize(212)));
  55. }];
  56. [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.centerX.equalTo(self.mas_centerX);
  58. make.top.equalTo(midView.mas_top).offset(-Fitsize(87));
  59. make.size.equalTo(CGSizeMake(Fitsize(208), Fitsize(208)));
  60. }];
  61. [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  62. make.centerY.equalTo(midView.mas_centerY);
  63. make.left.equalTo(midView.mas_left).offset(Fitsize(24));
  64. }];
  65. [detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  66. make.left.equalTo(titleLabel.mas_left);
  67. make.top.equalTo(titleLabel.mas_bottom).offset(1);
  68. }];
  69. [appstoreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  70. make.left.and.right.and.bottom.equalTo(midView);
  71. make.height.equalTo(@50);
  72. }];
  73. [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.left.and.right.equalTo(midView);
  75. make.bottom.equalTo(appstoreBtn.mas_top);
  76. make.height.equalTo(1);
  77. }];
  78. [closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  79. make.top.equalTo(midView.mas_bottom).offset(Fitsize(35));
  80. make.centerX.equalTo(midView.mas_centerX);
  81. }];
  82. }
  83. - (void)buttonClick:(UIButton *)button{
  84. if ([self.delegate respondsToSelector:@selector(markViewBtnClick:)]) {
  85. [self.delegate markViewBtnClick:button];
  86. }
  87. }
  88. @end