previewVideoLandscapeTopMoreView.m 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //
  2. // previewVideoLandscapeTopMoreView.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/7/13.
  6. //
  7. #import "previewVideoLandscapeTopMoreView.h"
  8. @implementation previewVideoLandscapeTopMoreView
  9. - (id)initWithFrame:(CGRect)frame{
  10. self = [super initWithFrame:frame];
  11. self.backgroundColor = [UIColor hwColor:@"#000000" alpha:0.1];
  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:@"#1E1E1E" alpha:0.9];
  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(0);
  36. make.right.mas_equalTo(10);
  37. make.width.mas_equalTo(310+10);
  38. make.bottom.mas_equalTo(0);
  39. //make.height.mas_equalTo(150);
  40. }];
  41. UILabel *moreLabel =[[UILabel alloc] init];
  42. moreLabel.text = NSLocalizedString(@"NAS_preview_video_more_tip",nil);
  43. moreLabel.textColor = [UIColor whiteColor];
  44. moreLabel.font = [UIFont boldSystemFontOfSize:14.0];
  45. [whiteBgView addSubview:moreLabel];
  46. [moreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  47. make.left.mas_equalTo(15);
  48. make.right.mas_equalTo(0);
  49. make.height.mas_equalTo(20);
  50. make.top.mas_equalTo(20);
  51. }];
  52. NSArray *butImageArr = @[@"nas_preview_share_white",@"edit_download_white_icon",@"edit_del_white_icon"];
  53. NSArray *butTextArr = @[NSLocalizedString(@"common_edit_share",nil),
  54. NSLocalizedString(@"my_set_no_File_download",nil),
  55. NSLocalizedString(@"File_upload_Record_delete",nil)];
  56. CGFloat butHeight = 40.0;
  57. CGFloat butTopSpace = 15.0;
  58. for (int i=0; i<butImageArr.count; i++) {
  59. UIButton *but = [[UIButton alloc] init];
  60. but.tag = 10+i;
  61. [but addTarget:self action:@selector(didClickButtonFun:) forControlEvents:UIControlEventTouchUpInside];
  62. //NSString *butTitle = [[NSString alloc] initWithFormat:@" %@",butTextArr[i]];
  63. //[but setImage:[UIImage imageNamed:butImageArr[i]] forState:UIControlStateNormal];
  64. //[but setTitle:butTitle forState:UIControlStateNormal];
  65. //[but setTitleColor:[UIColor hwColor:@"#0A132B"] forState:UIControlStateNormal];
  66. //[but setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
  67. //but.titleLabel.font = [UIFont systemFontOfSize:14.0];
  68. but.backgroundColor = [UIColor hwColor:@"#414141" alpha:1.0];
  69. but.layer.cornerRadius = 8;
  70. [whiteBgView addSubview:but];
  71. [but mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.left.mas_equalTo(15);
  73. make.right.mas_equalTo(-32 - 10);
  74. make.height.mas_equalTo(butHeight);
  75. make.top.mas_equalTo(60 + (butHeight+butTopSpace)*i);
  76. }];
  77. UIImageView *imageV = [UIImageView new];
  78. imageV.image = [UIImage imageNamed:butImageArr[i]];
  79. [but addSubview:imageV];
  80. [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
  81. make.left.mas_equalTo(12);
  82. make.width.mas_equalTo(24);
  83. make.height.mas_equalTo(24);
  84. make.centerY.mas_equalTo(but.mas_centerY);
  85. }];
  86. UILabel *textLabel =[[UILabel alloc] init];
  87. textLabel.text = butTextArr[i];
  88. textLabel.textColor = [UIColor whiteColor];
  89. textLabel.font = [UIFont systemFontOfSize:12.0];
  90. [but addSubview:textLabel];
  91. [textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
  92. make.left.equalTo(imageV.mas_right).offset(8);
  93. make.right.mas_equalTo(0);
  94. make.height.mas_equalTo(20);
  95. make.centerY.mas_equalTo(but.mas_centerY);
  96. }];
  97. }
  98. }
  99. #pragma mark 按钮事件
  100. - (void)didClickButtonFun:(UIButton*)but
  101. {
  102. NSInteger tag = but.tag;
  103. HLog(@"%ld",tag);
  104. [self removeFun];
  105. if(tag == 1){
  106. return;
  107. }
  108. if(_didClickButtonFun){
  109. _didClickButtonFun(tag);
  110. }
  111. }
  112. - (void)removeFun
  113. {
  114. [self removeFromSuperview];
  115. }
  116. @end