YOUPAIFateWindow.m 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // YOUPAIFateWindow.m
  3. // MSYOUPAI
  4. //
  5. // Created by xiaohaoran on 2022/3/30.
  6. // Copyright © 2022 MS. All rights reserved.
  7. //
  8. #import "YOUPAIFateWindow.h"
  9. @interface YOUPAIFateWindow ()
  10. @end
  11. @implementation YOUPAIFateWindow
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. [self setupUI];
  15. }
  16. -(void)setupUI{
  17. //bgView
  18. UIView *bgView = [UIView new];
  19. [self.view addSubview:bgView];
  20. [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
  21. make.centerY.mas_equalTo(0);
  22. make.left.mas_equalTo(31);
  23. make.right.mas_equalTo(-31);
  24. make.height.mas_equalTo(417+37);
  25. }];
  26. bgView.backgroundColor = [UIColor clearColor];
  27. UIView *bgView1 = [UIView new];
  28. [bgView addSubview:bgView1];
  29. [bgView1 mas_makeConstraints:^(MASConstraintMaker *make) {
  30. make.top.mas_equalTo(37);
  31. make.left.mas_equalTo(0);
  32. make.right.mas_equalTo(0);
  33. make.bottom.mas_equalTo(0);
  34. }];
  35. bgView1.backgroundColor = [UIColor whiteColor];
  36. bgView1.layer.cornerRadius = 16;
  37. bgView1.clipsToBounds = YES;
  38. //图片
  39. UIImageView *topImage = [UIImageView new];
  40. [bgView addSubview:topImage];
  41. [topImage mas_makeConstraints:^(MASConstraintMaker *make) {
  42. make.top.mas_equalTo(0);
  43. make.centerX.mas_equalTo(0);
  44. make.size.mas_equalTo(CGSizeMake(118, 82));
  45. }];
  46. topImage.image = [UIImage imageNamed:@"vqu_images_fate_window"];
  47. topImage.contentMode = UIViewContentModeScaleAspectFill;
  48. //
  49. NSString *contentString = @"1、牵线说明:\n相语欢颜平台将用大数据为你匹配优质男用户,优先将你的个人资料卡主动推送曝光给当前在线的优质异性;\n\n2、缘分同意:\n平台牵线匹配成功后,男生回复代表同意缘分,私聊由男生支付钻石;\n\n3、牵线秘籍:\n完善个人资料、通过真人认证、视频语音、互动即时回复、每日登录等活跃女神用户,可快速增加牵线曝光的次数哦。";
  50. CGRect fr = [contentString boundingRectWithSize:CGSizeMake(KScreenWidth-90., CGFLOAT_MAX) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]} context:nil];
  51. NSString *strAmountText = contentString;
  52. NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:strAmountText attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:15],NSForegroundColorAttributeName: LZ273145Color}];
  53. [attributedString setAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:15],NSForegroundColorAttributeName: HexColorFromRGB(0xFE66A4)} range:[strAmountText rangeOfString:@"1、牵线说明:"]];
  54. [attributedString setAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:15],NSForegroundColorAttributeName: HexColorFromRGB(0xFE66A4)} range:[strAmountText rangeOfString:@"2、缘分同意:"]];
  55. [attributedString setAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:15],NSForegroundColorAttributeName: HexColorFromRGB(0xFE66A4)} range:[strAmountText rangeOfString:@"3、牵线秘籍:"]];
  56. UILabel *contextLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 62,fr.size.width, fr.size.height)];
  57. contextLabel.attributedText = attributedString;
  58. contextLabel.font = [UIFont systemFontOfSize:15];
  59. contextLabel.numberOfLines = 0;
  60. [bgView1 addSubview:contextLabel];
  61. //btn
  62. UIButton *iknowBtn = [UIButton new];
  63. [bgView1 addSubview:iknowBtn];
  64. [iknowBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.bottom.mas_equalTo(-20);
  66. make.left.mas_equalTo(36.5);
  67. make.right.mas_equalTo(-36.5);
  68. make.height.mas_equalTo(49);
  69. }];
  70. [iknowBtn setTitle:@"我知道了" forState:UIControlStateNormal];
  71. iknowBtn.layer.cornerRadius = 24.5;
  72. iknowBtn.clipsToBounds = YES;
  73. [iknowBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  74. iknowBtn.titleLabel.font = [UIFont systemFontOfSize:16];
  75. [iknowBtn setBackgroundImage:[LCTools ColorImage:CGSizeMake(KScreenWidth-67.5*2, 49) FromColors:@[LZFFB5DBColor,LZFE66A4Color] ByGradientType:1] forState:UIControlStateNormal];
  76. [iknowBtn addTarget:self action:@selector(iknowBtnClick) forControlEvents:UIControlEventTouchUpInside];
  77. }
  78. -(void)iknowBtnClick{
  79. [self dismissViewControllerAnimated:YES completion:^{}];
  80. }
  81. @end