DelAccProtocolViewController.m 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. //
  2. //
  3. // AICity
  4. //
  5. // Created by 刘伟伟 on 2023/7/20.
  6. // Copyright © 2023 wei.z. All rights reserved.
  7. //
  8. #import "DelAccProtocolViewController.h"
  9. #import "CommonBarView.h"
  10. @interface DelAccProtocolViewController ()<UITableViewDelegate,UITableViewDataSource>
  11. @property(nonatomic,strong)CommonBarView *customerbar;
  12. @property(nonatomic,strong)UITableView *tableView;
  13. @property(nonatomic,strong)NSString *cc;
  14. @property(nonatomic,assign)int height;
  15. @end
  16. @implementation DelAccProtocolViewController
  17. -(UIStatusBarStyle)preferredStatusBarStyle{
  18. return UIStatusBarStyleLightContent;
  19. }
  20. - (void)viewDidLoad {
  21. [super viewDidLoad];
  22. // Do any additional setup after loading the view.
  23. self.fd_prefersNavigationBarHidden = true;
  24. self.view.backgroundColor = rgba(18, 23, 41, 1);
  25. self.cc = @"注销权\n如您不需要使用韩小圈的服务,您可以向平台申请注销您的账号。您可以在快影 APP“我的——设置——账号安全中心——注销账号”来申请账号注销。请注意,账号注销是不可恢复的操作,您需要自行备份账号下相关信息和数据,操作前请确认与韩小圈相关的所有服务均已妥善处理。\n在您注销韩小圈账号后,该账号下的内容、信息、数据、记录等将会被删除或匿名化处理(但法律法规另有规定或监管部门另有要求的除外)。 ";
  26. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  27. paragraphStyle.lineSpacing = 5;// 字体的行间距
  28. NSDictionary *defaultAttributesC = @{
  29. NSFontAttributeName:[UIFont systemFontOfSize:14],
  30. NSForegroundColorAttributeName:rgba(255, 255, 255, 0.6),
  31. NSParagraphStyleAttributeName:paragraphStyle
  32. };
  33. NSMutableAttributedString * attributedStrX = [[NSMutableAttributedString alloc] initWithString:self.cc attributes:defaultAttributesC];
  34. NSStringDrawingOptions options = NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading;
  35. CGRect rect = [attributedStrX boundingRectWithSize:CGSizeMake(kScreenWidth-24, CGFLOAT_MAX) options:options context:nil];
  36. self.height = rect.size.height + 10;
  37. [self.view addSubview:self.customerbar];
  38. [self.view addSubview:self.tableView];
  39. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  40. make.left.right.bottom.equalTo(self.view);
  41. make.top.equalTo(self.customerbar.mas_bottom);
  42. }];
  43. }
  44. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  45. return 1;
  46. }
  47. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  48. return self.height;
  49. }
  50. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  51. UITableViewCell * cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"privatecell"];
  52. cell.selectionStyle = UITableViewCellSelectionStyleNone;
  53. cell.backgroundColor = [UIColor clearColor];
  54. UILabel *lab = [UILabel new];
  55. lab.textColor = rgba(255, 255, 255, 0.6);
  56. lab.font = [UIFont systemFontOfSize:14];
  57. lab.numberOfLines = 0;
  58. NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
  59. paragraphStyle.lineSpacing = 5;// 字体的行间距
  60. NSDictionary *defaultAttributesC = @{
  61. NSFontAttributeName:[UIFont systemFontOfSize:14],
  62. NSForegroundColorAttributeName:rgba(255, 255, 255, 0.6),
  63. NSParagraphStyleAttributeName:paragraphStyle
  64. };
  65. NSMutableAttributedString * attributedStrX = [[NSMutableAttributedString alloc] initWithString:self.cc attributes:defaultAttributesC];
  66. lab.attributedText = attributedStrX;;
  67. [cell.contentView addSubview:lab];
  68. [lab mas_makeConstraints:^(MASConstraintMaker *make) {
  69. make.center.equalTo(cell.contentView);
  70. make.width.mas_equalTo(@(SCREEN_WIDTH-24));
  71. }];
  72. return cell;
  73. }
  74. -(UITableView *)tableView{
  75. if(!_tableView){
  76. _tableView =[[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
  77. _tableView.delegate = self;
  78. _tableView.dataSource = self;
  79. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  80. _tableView.showsVerticalScrollIndicator = false;
  81. _tableView.showsHorizontalScrollIndicator = false;
  82. // _tableView.backgroundColor = rgba(18, 23, 41, 1);
  83. _tableView.backgroundColor = [UIColor clearColor];
  84. if (@available(iOS 11, *)) {
  85. _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  86. _tableView.estimatedRowHeight = 0;
  87. _tableView.estimatedSectionFooterHeight = 0;
  88. _tableView.estimatedSectionHeaderHeight = 0;
  89. UIWindow *keyWindow = UIApplication.sharedApplication.keyWindow;
  90. UIEdgeInsets safeAreaInsets = keyWindow.safeAreaInsets;
  91. CGFloat topSafeArea = safeAreaInsets.top;
  92. _tableView.contentInset = UIEdgeInsetsMake(0, 0, BAR_HEIGHT, 0);
  93. // _tableView2.contentInset = UIEdgeInsetsMake(-35, 0, 0, 0);
  94. }
  95. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 // only Xcode 13+ needs and can compile this
  96. if (@available(iOS 15.0, *)) {
  97. _tableView.sectionHeaderTopPadding = 0;
  98. }
  99. #endif
  100. }
  101. return _tableView;
  102. }
  103. -(void)backAction{
  104. [self.navigationController popViewControllerAnimated:true];
  105. }
  106. -(CommonBarView *)customerbar{
  107. if(!_customerbar){
  108. CGFloat h=0;
  109. if(@available(iOS 13.0, *)){
  110. UIStatusBarManager *sc= [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager;
  111. CGRect f=sc.statusBarFrame;
  112. h=f.size.height;
  113. }else{
  114. h=[UIApplication sharedApplication].statusBarFrame.size.height;
  115. }
  116. if(h>=40){
  117. h=30;
  118. }
  119. _customerbar =[[CommonBarView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 72-20+h)];
  120. _customerbar.bgView.backgroundColor = [UIColor clearColor];
  121. _customerbar.label.text=@"服务协议";
  122. _customerbar.bgView.alpha = 1;
  123. _customerbar.label.textColor = rgba(255, 255, 255, 1);
  124. // _customerbar.leftButton.hidden = true;
  125. // [_customerbar.leftButton setImage:[UIImage imageNamed:@"his_back"] forState:UIControlStateNormal];
  126. [_customerbar.rightButton setImage:[UIImage imageNamed:@"Frame 9411"] forState:UIControlStateNormal];
  127. [_customerbar.rightButton setTitle:@"编辑" forState:UIControlStateNormal];
  128. // [_customerbar.rightButton setImage:[self imageWithColor:[UIColor clearColor]] forState:UIControlStateSelected];
  129. [_customerbar.rightButton setTitle:@"取消" forState:UIControlStateSelected];
  130. [_customerbar.rightButton setTitleColor:rgba(255, 255, 255, 1) forState:UIControlStateNormal];
  131. _customerbar.rightButton.titleLabel.font =[UIFont systemFontOfSize:14];
  132. _customerbar.rightButton.hidden = true;
  133. [_customerbar.leftButton addTarget:self action:@selector(backAction) forControlEvents:UIControlEventTouchUpInside];
  134. // [_customerbar.rightButton addTarget:self action:@selector(changeSelState:) forControlEvents:UIControlEventTouchUpInside];
  135. // [_customerbar.rightButton addTarget:self action:@selector(shareAction) forControlEvents:UIControlEventTouchUpInside];
  136. // [_customerbar.rightButton mas_remakeConstraints:^(MASConstraintMaker *make) {
  137. // make.centerY.equalTo(_customerbar.leftButton);
  138. // make.right.equalTo(_customerbar).offset(-15);
  139. // make.size.mas_equalTo(CGSizeMake(23, 23));
  140. // }];
  141. }
  142. return _customerbar;
  143. }
  144. @end