YOUPAILZCheckDynamicTypeWindow.m 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // YOUPAILZCheckDynamicTypeWindow.m
  3. // MSYOUPAI
  4. //
  5. // Created by CY on 2022/3/7.
  6. // Copyright © 2022 MS. All rights reserved.
  7. //
  8. #import "YOUPAILZCheckDynamicTypeWindow.h"
  9. @interface YOUPAILZCheckDynamicTypeWindow ()
  10. @end
  11. @implementation YOUPAILZCheckDynamicTypeWindow
  12. - (void)viewDidLoad {
  13. [super viewDidLoad];
  14. self.baseView.hidden = YES;
  15. [self youpaifinitUI];
  16. }
  17. - (void)youpaifinitUI{
  18. UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 178.0f + SafeHeight)];
  19. bgV.backgroundColor = [UIColor whiteColor];
  20. [self.view addSubview:bgV];
  21. [LCTools clipCorner:UIRectCornerTopLeft|UIRectCornerTopRight View:bgV size:CGSizeMake(16.0f, 16.0f)];
  22. [bgV mas_makeConstraints:^(MASConstraintMaker *make) {
  23. make.left.right.bottom.offset(0.0f);
  24. make.height.offset(178.0f + SafeHeight);
  25. }];
  26. NSMutableArray *btns = [NSMutableArray array];
  27. NSArray *contents = @[
  28. @{@"image":@"vqu_images_dynamic_send_image",@"title":@"发布图片"},
  29. @{@"image":@"vqu_images_dynamic_send_video",@"title":@"发布视频"},
  30. ];
  31. for (NSInteger i = 0; i < 2; i ++) {
  32. UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
  33. btn.tag = i;
  34. [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
  35. [bgV addSubview:btn];
  36. [btns addObject:btn];
  37. UIImageView *imgV = [[UIImageView alloc] init];
  38. imgV.image = [UIImage imageNamed:contents[i][@"image"]];
  39. [btn addSubview:imgV];
  40. [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
  41. make.centerX.equalTo(btn);
  42. make.top.offset(0.0f);
  43. make.size.mas_offset(CGSizeMake(53.0f, 53.0f));
  44. }];
  45. UILabel *titleL = [[UILabel alloc] init];
  46. titleL.font = LCFont(11.0f);
  47. titleL.textColor = LZ475A7DColor;
  48. titleL.textAlignment = NSTextAlignmentCenter;
  49. titleL.text = contents[i][@"title"];
  50. [btn addSubview:titleL];
  51. [titleL mas_makeConstraints:^(MASConstraintMaker *make) {
  52. make.left.right.offset(0.0f);
  53. make.top.equalTo(imgV.mas_bottom).offset(5.0f);
  54. }];
  55. }
  56. CGFloat space = (KScreenWidth - (53.0f * contents.count)) / contents.count;
  57. [btns mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:space leadSpacing:space/2 tailSpacing:space/2];
  58. [btns mas_makeConstraints:^(MASConstraintMaker *make) {
  59. make.top.offset(45.0f);
  60. make.height.offset(72.0f);
  61. }];
  62. UIButton *cencalBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  63. [cencalBtn setImage:[UIImage imageNamed:@"vqu_images_dynamic_send_cencal"] forState:UIControlStateNormal];
  64. [cencalBtn addTarget:self action:@selector(cencalBtnClick) forControlEvents:UIControlEventTouchUpInside];
  65. [bgV addSubview:cencalBtn];
  66. [cencalBtn mas_makeConstraints:^(MASConstraintMaker *make) {
  67. make.bottom.offset(-SafeHeight-12.0f);
  68. make.centerX.equalTo(bgV);
  69. make.size.mas_offset(CGSizeMake(25.0f, 25.0f));
  70. }];
  71. }
  72. - (void)btnClick:(UIButton *)sender{
  73. [self dismissViewControllerAnimated:YES completion:^{
  74. if (self.selectedSendDynamicTypeBlock != nil) {
  75. self.selectedSendDynamicTypeBlock(sender.tag);
  76. }
  77. }];
  78. }
  79. - (void)cencalBtnClick{
  80. [self dismissViewControllerAnimated:YES completion:nil];
  81. }
  82. @end