STBaseSuspensionWindow.m 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. //
  2. // STBaseSuspensionWindow.m
  3. // BuguLive
  4. //
  5. // Created by 岳克奎 on 17/1/18.
  6. // Copyright © 2017年 xfg. All rights reserved.
  7. //
  8. #import "STBaseSuspensionWindow.h"
  9. @implementation STBaseSuspensionWindow
  10. #pragma mark -tap手势
  11. - (UITapGestureRecognizer *)tapGestureRecognizer
  12. {
  13. if (!_tapGestureRecognizer)
  14. {
  15. _tapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapGestureRecognizerClick:)];
  16. [self addGestureRecognizer:_tapGestureRecognizer];
  17. }
  18. return _tapGestureRecognizer;
  19. }
  20. //基础悬浮widnow的等级
  21. - (void)setStSuspensionWindowLevelValue:(CGFloat)stSuspensionWindowLevelValue
  22. {
  23. _stSuspensionWindowLevelValue = stSuspensionWindowLevelValue;
  24. }
  25. #pragma mark ------------------------------------------- private methods
  26. //tap子重写
  27. - (void)tapGestureRecognizerClick:(UITapGestureRecognizer *)tapGestureRecognizer
  28. {
  29. }
  30. //pan 子重写
  31. - (void)panGestureRecognizerClick:(UIPanGestureRecognizer *)panGestureRecognizer
  32. {
  33. }
  34. - (void)showPanClickForSTWindowOfPoint:(CGPoint)panPoint andMovePoint:(CGPoint)movePoint
  35. {
  36. self.transform = CGAffineTransformTranslate( self.transform, movePoint.x, movePoint.y);
  37. [self.panGestureRecognizer setTranslation:CGPointZero inView:self];
  38. if (self.panGestureRecognizer.state == UIGestureRecognizerStateBegan)
  39. {
  40. }
  41. if (self.panGestureRecognizer.state == UIGestureRecognizerStateChanged)
  42. {
  43. }
  44. if (self.panGestureRecognizer.state == UIGestureRecognizerStateEnded)
  45. {
  46. if(self.x<0)
  47. {
  48. [UIView animateWithDuration:0.2 animations:^{
  49. self.x = 0;
  50. } completion:^(BOOL finished) {
  51. }];
  52. }
  53. if(self.frame.origin.y<0)
  54. {
  55. [UIView animateWithDuration:0.2 animations:^{
  56. self.y = 0;
  57. } completion:^(BOOL finished) {
  58. }];
  59. }
  60. if(self.frame.origin.y> kScreenH-0.6*kScreenW)
  61. {
  62. [UIView animateWithDuration:0.2 animations:^{
  63. self.y = kScreenH-0.6*kScreenW;
  64. } completion:^(BOOL finished) {
  65. }];
  66. }
  67. if(self.x>kScreenW-0.4*kScreenW)
  68. {
  69. [UIView animateWithDuration:0.2 animations:^{
  70. self.x = kScreenW-0.4*kScreenW;
  71. } completion:^(BOOL finished) {
  72. }];
  73. }
  74. }
  75. }
  76. @end