playerSetView.m 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. //
  2. // playerSetView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/6/24.
  6. //
  7. #import "playerSetView.h"
  8. #import "SYJUISwitch.h"
  9. @interface playerSetView ()
  10. @property(nonatomic, strong) SYJUISwitch * bottomNavSwitch;//底部导航栏开关
  11. @property(nonatomic, strong) SYJUISwitch * fullScreenSwitch;//全面屏开关
  12. @end
  13. @implementation playerSetView
  14. - (id)initWithFrame:(CGRect)frame{
  15. self = [super initWithFrame:frame];
  16. self.backgroundColor = [UIColor hwColor:@"000000" alpha:0.6];
  17. [self drawAnyView];
  18. return self;
  19. }
  20. - (void)drawAnyView{
  21. //扩大金融云机范围按钮
  22. UIButton *bigButton = [[UIButton alloc] init];
  23. bigButton.tag = 1;
  24. [bigButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  25. [self addSubview:bigButton];
  26. //bigButton.backgroundColor = [UIColor greenColor];
  27. [bigButton mas_makeConstraints:^(MASConstraintMaker *make) {
  28. make.top.mas_equalTo(0);
  29. make.right.mas_equalTo(0);
  30. make.left.mas_equalTo(0);
  31. make.bottom.mas_equalTo(0);
  32. }];
  33. UIView* blackBgView = [UIView new];
  34. blackBgView.layer.cornerRadius = 20;
  35. blackBgView.backgroundColor = [UIColor hwColor:@"#202630"];
  36. [self addSubview:blackBgView];
  37. [blackBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  38. make.height.mas_equalTo(256);
  39. make.width.mas_equalTo(245);
  40. make.centerX.mas_equalTo(0.f);
  41. make.centerY.mas_equalTo(00.f);
  42. }];
  43. UIView *bg1View = [UIView new];
  44. bg1View.layer.cornerRadius = 12;
  45. bg1View.backgroundColor = [UIColor hwColor:@"#29313D"];
  46. [blackBgView addSubview:bg1View];
  47. [bg1View mas_makeConstraints:^(MASConstraintMaker *make) {
  48. make.height.mas_equalTo(74);
  49. make.left.mas_equalTo(12);
  50. make.right.mas_equalTo(-12);
  51. make.top.mas_equalTo(16.f);
  52. }];
  53. //底部导航栏开关
  54. _bottomNavSwitch = [[SYJUISwitch alloc] initWithFrame:CGRectMake(0, 0, 44, 22)];
  55. _bottomNavSwitch.onTintColor = HW13B2EBColor;
  56. _bottomNavSwitch.offTintColor = [UIColor hwColor:@"#E3E8F1"];
  57. [_bottomNavSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:UIControlEventValueChanged];
  58. [bg1View addSubview:_bottomNavSwitch];
  59. [_bottomNavSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
  60. make.left.mas_equalTo(35.f);
  61. make.top.mas_equalTo(16.f);
  62. make.width.mas_equalTo(44.f);
  63. make.height.mas_equalTo(22.f);
  64. }];
  65. // BOOL haveOpenMask = [HWDataManager getBoolWithKey:Consn_Fanzhuan_Exit_app_Open];
  66. // [_bottomNavSwitch setOn:haveOpenMask];
  67. UILabel *navSwitchTipLabel = [[UILabel alloc] init];
  68. navSwitchTipLabel.text = NSLocalizedString(@"cloudPhone_nav_show_tip",nil);
  69. navSwitchTipLabel.textAlignment = NSTextAlignmentCenter;
  70. navSwitchTipLabel.textColor = [UIColor whiteColor];
  71. navSwitchTipLabel.font = [UIFont systemFontOfSize:10.0];
  72. [bg1View addSubview:navSwitchTipLabel];
  73. [navSwitchTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  74. make.right.equalTo(bg1View.mas_centerX).offset(-10.f);
  75. make.left.mas_equalTo(10);
  76. make.top.equalTo(_bottomNavSwitch.mas_bottom).offset(6);
  77. }];
  78. //全面屏开关
  79. _fullScreenSwitch = [[SYJUISwitch alloc] initWithFrame:CGRectMake(0, 0, 44, 22)];
  80. _fullScreenSwitch.onTintColor = HW13B2EBColor;
  81. _fullScreenSwitch.offTintColor = [UIColor hwColor:@"#E3E8F1"];
  82. [_fullScreenSwitch addTarget:self action:@selector(maskSwitchPressed:) forControlEvents:UIControlEventValueChanged];
  83. [bg1View addSubview:_fullScreenSwitch];
  84. [_fullScreenSwitch mas_makeConstraints:^(MASConstraintMaker *make) {
  85. make.right.mas_equalTo(-35.f);
  86. make.top.mas_equalTo(16.f);
  87. make.width.mas_equalTo(44.f);
  88. make.height.mas_equalTo(22.f);
  89. }];
  90. // BOOL haveOpenMask = [HWDataManager getBoolWithKey:Consn_Fanzhuan_Exit_app_Open];
  91. // [_bottomNavSwitch setOn:haveOpenMask];
  92. UILabel *fullScreenTipLabel = [[UILabel alloc] init];
  93. fullScreenTipLabel.text = NSLocalizedString(@"cloudPhone_fullScreen_show_tip",nil);
  94. fullScreenTipLabel.textAlignment = NSTextAlignmentCenter;
  95. fullScreenTipLabel.textColor = [UIColor whiteColor];
  96. fullScreenTipLabel.font = [UIFont systemFontOfSize:10.0];
  97. [bg1View addSubview:fullScreenTipLabel];
  98. [fullScreenTipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  99. make.left.equalTo(bg1View.mas_centerX).offset(10.f);
  100. make.right.mas_equalTo(-10);
  101. make.top.equalTo(_bottomNavSwitch.mas_bottom).offset(6);
  102. }];
  103. /**********************************************************************************/
  104. UIView *bg2View = [UIView new];
  105. bg2View.layer.cornerRadius = 12;
  106. bg2View.backgroundColor = [UIColor hwColor:@"#29313D"];
  107. [blackBgView addSubview:bg2View];
  108. [bg2View mas_makeConstraints:^(MASConstraintMaker *make) {
  109. make.height.mas_equalTo(74);
  110. make.left.mas_equalTo(12);
  111. make.right.mas_equalTo(-12);
  112. make.top.equalTo(bg1View.mas_bottom).offset(12);
  113. }];
  114. NSArray *titleArr = @[NSLocalizedString(@"cloudPhone_set_screenshot_tip",nil),
  115. NSLocalizedString(@"my_set_no_restart_phone",nil),
  116. NSLocalizedString(@"cloudPhone_set_exit_tip",nil),
  117. ];
  118. NSArray *imageArr = @[@"cloudPhone_set_screenshot",
  119. @"cloudPhone_set_restart",
  120. @"cloudPhone_set_exit",
  121. ];
  122. CGFloat butTopY = 15.0;
  123. CGFloat imageWH = 24.0;
  124. CGFloat butHeight = imageWH +20 +5;
  125. CGFloat butWidth = (245 -12*2)/3.0; //70.0;
  126. CGFloat butSpace = 0.0; //(245 - butWidth*3)/3.0;
  127. for (int i=0; i<titleArr.count; i++) {
  128. UIButton *but = [[UIButton alloc] init];
  129. but.tag = 10+i;
  130. [but addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  131. [bg2View addSubview:but];
  132. //but.backgroundColor = [UIColor greenColor];
  133. [but mas_makeConstraints:^(MASConstraintMaker *make) {
  134. make.left.mas_equalTo(butSpace + (butWidth+butSpace)*(i%4));
  135. make.width.mas_equalTo(butWidth);
  136. make.height.mas_equalTo(butHeight);
  137. make.top.mas_equalTo(butTopY + (i/4)* (butHeight + 25) );
  138. }];
  139. UIImageView *imageV = [[UIImageView alloc] init];
  140. imageV.image = [UIImage imageNamed:imageArr[i]];
  141. [but addSubview:imageV];
  142. [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
  143. make.centerX.mas_equalTo(0);
  144. make.width.mas_equalTo(imageWH);
  145. make.height.mas_equalTo(imageWH);
  146. make.top.mas_equalTo(0);
  147. }];
  148. UILabel *textLabel = [[UILabel alloc] init];
  149. textLabel.textAlignment = NSTextAlignmentCenter;
  150. textLabel.font = [UIFont systemFontOfSize:10.0];
  151. textLabel.textColor = [UIColor whiteColor];
  152. textLabel.text = titleArr[i];
  153. [but addSubview:textLabel];
  154. //textLabel.backgroundColor = [UIColor redColor];
  155. [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  156. make.centerX.mas_equalTo(0);
  157. make.width.mas_equalTo(butWidth);
  158. make.height.mas_equalTo(20);
  159. make.top.equalTo(imageV.mas_bottom).offset(5);
  160. }];
  161. }
  162. /**********************************************************************************/
  163. UIButton *TVButton = [[UIButton alloc] init];
  164. TVButton.tag = 100;
  165. [TVButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  166. [TVButton setTitle:NSLocalizedString(@"my_set_no_TV_p2p",nil) forState:(UIControlStateNormal)];
  167. [TVButton setTitle:NSLocalizedString(@"my_set_no_close_TV_p2p",nil) forState:(UIControlStateSelected)];
  168. TVButton.layer.cornerRadius = 12;
  169. [TVButton.titleLabel setFont:[UIFont boldSystemFontOfSize:14.f]];
  170. TVButton.backgroundColor = [UIColor hwColor:@"#29313D"];
  171. [blackBgView addSubview:TVButton];
  172. [TVButton mas_makeConstraints:^(MASConstraintMaker *make) {
  173. make.height.mas_equalTo(50);
  174. make.left.mas_equalTo(12);
  175. make.right.mas_equalTo(-12);
  176. make.top.equalTo(bg2View.mas_bottom).offset(12);
  177. }];
  178. }
  179. - (void)maskSwitchPressed:(UISwitch *)maskSwitch{
  180. HLog(@"11111");
  181. // [HWDataManager setBoolWithKey:Consn_Fanzhuan_Exit_app_Open value:maskSwitch.on];
  182. //
  183. // if (maskSwitch.on) {
  184. // [[iToast makeText:NSLocalizedString(@"my_set_no_fanzhuan_exit_open",nil)] show];
  185. // }
  186. // else{
  187. // [[iToast makeText:NSLocalizedString(@"my_set_no_fanzhuan_exit_close",nil)] show];
  188. // }
  189. }
  190. #pragma mark 按钮事件
  191. - (void)didClickButtonFun:(UIButton*)but
  192. {
  193. NSInteger tag = but.tag;
  194. HLog(@"%ld",tag);
  195. [self removeFun];
  196. if(tag == 1){
  197. return;
  198. }
  199. if(tag == 100 && but.selected){
  200. tag = 101;
  201. }
  202. if(_didClickButtonFun){
  203. _didClickButtonFun(tag);
  204. }
  205. }
  206. - (void)removeFun
  207. {
  208. [self removeFromSuperview];
  209. }
  210. @end