HMCenterPopView.m 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. //
  2. // HMCenterPopView.m
  3. // BuguLive
  4. //
  5. // Created by 范东 on 2019/1/16.
  6. // Copyright © 2019 xfg. All rights reserved.
  7. //
  8. #import "HMCenterPopView.h"
  9. #import "ReleaseDynamicVC.h"
  10. #import "BogoRoomUIViewController.h"
  11. //#import "PublishVoiceViewController.h"
  12. @interface HMCenterPopView()
  13. @property (nonatomic, strong) UIView *shadowView;
  14. @property (nonatomic, copy) clickPopViewBtnBlock clickPopViewBtnBlock;
  15. @end
  16. @implementation HMCenterPopView
  17. - (IBAction)startLiveBtnAction:(id)sender {
  18. [self hide];
  19. if (self.clickPopViewBtnBlock) {
  20. self.clickPopViewBtnBlock(HMCenterPopViewBtnTypeLive);
  21. }
  22. }
  23. - (IBAction)startVideoBtnAction:(id)sender {
  24. [self hide];
  25. if (self.clickPopViewBtnBlock) {
  26. self.clickPopViewBtnBlock(HMCenterPopViewBtnTypeVideo);
  27. }
  28. }
  29. - (IBAction)closeBtnAction:(id)sender {
  30. [self hide];
  31. if (self.clickPopViewBtnBlock) {
  32. self.clickPopViewBtnBlock(HMCenterPopViewBtnTypeClose);
  33. }
  34. }
  35. - (IBAction)voiceRoom:(id)sender {
  36. NSLog(@"点击了语音房间");
  37. [self hide];
  38. /*
  39. BogoRoomUIViewController *vc = [BogoRoomUIViewController new];
  40. [[AppDelegate sharedAppDelegate]presentViewController:vc animated:YES completion:nil];
  41. */
  42. ReleaseDynamicVC *pushVC = [ReleaseDynamicVC new];
  43. // __weak __typeof(self)weakSelf = self;
  44. // pushVC.postFinishBlock = ^(BOOL isFinish) {
  45. // if (isFinish) {
  46. // [weakSelf.logic loadListDataWithAct:self.homeType];
  47. // }
  48. // };
  49. [[AppDelegate sharedAppDelegate]presentViewController:pushVC animated:YES completion:nil];
  50. // PublishVoiceViewController *vc = [PublishVoiceViewController new];
  51. // [[AppDelegate sharedAppDelegate]presentViewController:vc animated:YES completion:nil];
  52. }
  53. - (IBAction)startDynamicBtnAction:(UIButton *)sender {
  54. [self hide];
  55. if (self.clickPopViewBtnBlock) {
  56. self.clickPopViewBtnBlock(HMCenterPopViewBtnTypeVideo);
  57. }
  58. }
  59. - (void)awakeFromNib{
  60. [super awakeFromNib];
  61. self.frame = CGRectMake(0, kScreenH, kScreenW, 200);
  62. [self.voice setTitle:ASLocalizedString(@"动态") forState:UIControlStateNormal];
  63. self.liveBtn.imagePosition = QMUIButtonImagePositionTop;
  64. self.videoBtn.imagePosition = QMUIButtonImagePositionTop;
  65. self.dynamicBtn.imagePosition = QMUIButtonImagePositionTop;
  66. self.voice.imagePosition = QMUIButtonImagePositionTop;
  67. }
  68. - (void)show:(UIView *)superView{
  69. [superView addSubview:self.shadowView];
  70. [superView addSubview:self];
  71. [UIView animateWithDuration:0.25 animations:^{
  72. self.shadowView.alpha = 1;
  73. self.y = kScreenH - 200;
  74. }];
  75. }
  76. - (void)hide{
  77. [UIView animateWithDuration:0.25 animations:^{
  78. self.shadowView.alpha = 0;
  79. self.y = kScreenH;
  80. } completion:^(BOOL finished) {
  81. [self.shadowView removeFromSuperview];
  82. [self removeFromSuperview];
  83. }];
  84. }
  85. - (void)setClickPopViewBtnBlock:(clickPopViewBtnBlock)clickPopViewBtnBlock{
  86. _clickPopViewBtnBlock = clickPopViewBtnBlock;
  87. }
  88. - (UIView *)shadowView{
  89. if (!_shadowView) {
  90. _shadowView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH)];
  91. _shadowView.backgroundColor = [kBlackColor colorWithAlphaComponent:0.5];
  92. _shadowView.alpha = 0;
  93. _shadowView.userInteractionEnabled = YES;
  94. UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(hide)];
  95. [_shadowView addGestureRecognizer:tap];
  96. }
  97. return _shadowView;
  98. }
  99. /*
  100. // Only override drawRect: if you perform custom drawing.
  101. // An empty implementation adversely affects performance during animation.
  102. - (void)drawRect:(CGRect)rect {
  103. // Drawing code
  104. }
  105. */
  106. @end