previewLandscapeTopMoreView.m 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // previewLandscapeTopMoreView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/7/12.
  6. //
  7. #import "previewLandscapeTopMoreView.h"
  8. @implementation previewLandscapeTopMoreView
  9. - (id)initWithFrame:(CGRect)frame{
  10. self = [super initWithFrame:frame];
  11. self.backgroundColor = [UIColor hwColor:@"#000000" alpha:0.3];
  12. [self drawAnyView];
  13. return self;
  14. }
  15. -(void)drawAnyView
  16. {
  17. //大按钮响应
  18. UIButton *bigRightButton = [[UIButton alloc] init];
  19. bigRightButton.tag = 1;
  20. [bigRightButton addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  21. [self addSubview:bigRightButton];
  22. //bigRightButton.backgroundColor= [UIColor greenColor];
  23. [bigRightButton mas_makeConstraints:^(MASConstraintMaker *make) {
  24. make.top.mas_equalTo(0);
  25. make.left.mas_equalTo(0);
  26. make.right.mas_equalTo(0);
  27. make.bottom.mas_equalTo(0);
  28. }];
  29. UIView *whiteBgView = [[UIView alloc] init];
  30. whiteBgView.backgroundColor = [UIColor hwColor:@"#333333"];
  31. [self addSubview:whiteBgView];
  32. whiteBgView.layer.cornerRadius = 8;
  33. whiteBgView.layer.masksToBounds = YES;
  34. [whiteBgView mas_makeConstraints:^(MASConstraintMaker *make) {
  35. make.top.mas_equalTo(65);
  36. make.right.mas_equalTo(-16);
  37. make.width.mas_equalTo(112);
  38. make.height.mas_equalTo(120);
  39. //make.height.mas_equalTo(150);
  40. }];
  41. NSArray *butImageArr = @[@"edit_download_white_icon",@"edit_del_white_icon"];
  42. NSArray *butTextArr = @[NSLocalizedString(@"my_set_no_File_download",nil),
  43. NSLocalizedString(@"File_upload_Record_delete",nil)];
  44. CGFloat butHeight = 50.0;
  45. for (int i=0; i<butImageArr.count; i++) {
  46. UIButton *but = [[UIButton alloc] init];
  47. but.tag = 10+i;
  48. [but addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  49. NSString *butTitle = [[NSString alloc] initWithFormat:@" %@",butTextArr[i]];
  50. [but setImage:[UIImage imageNamed:butImageArr[i]] forState:UIControlStateNormal];
  51. [but setTitle:butTitle forState:UIControlStateNormal];
  52. //[but setTitleColor:[UIColor hwColor:@"#0A132B"] forState:UIControlStateNormal];
  53. [but setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  54. but.titleLabel.font = [UIFont systemFontOfSize:14.0];
  55. [whiteBgView addSubview:but];
  56. [but mas_makeConstraints:^(MASConstraintMaker *make) {
  57. make.left.mas_equalTo(0);
  58. make.right.mas_equalTo(0);
  59. make.height.mas_equalTo(butHeight);
  60. make.top.mas_equalTo(10 + butHeight*i);
  61. }];
  62. // if(i != butImageArr.count -1){
  63. // UIView *lineV = [UIView new];
  64. // lineV.backgroundColor = [UIColor hwColor:@"#F3F5F9"];
  65. // [whiteBgView addSubview:lineV];
  66. //
  67. // [lineV mas_makeConstraints:^(MASConstraintMaker *make) {
  68. // make.left.mas_equalTo(8);
  69. // make.right.mas_equalTo(-8);
  70. // make.height.mas_equalTo(0.5);
  71. // make.top.mas_equalTo(butHeight*(i+1));
  72. // }];
  73. // }
  74. }
  75. }
  76. #pragma mark 按钮事件
  77. - (void)didClickButtonFun:(UIButton*)but
  78. {
  79. NSInteger tag = but.tag;
  80. HLog(@"%ld",tag);
  81. [self removeFun];
  82. if(tag == 1){
  83. return;
  84. }
  85. if(_didClickButtonFun){
  86. _didClickButtonFun(tag);
  87. }
  88. }
  89. - (void)removeFun
  90. {
  91. [self removeFromSuperview];
  92. }
  93. @end