|
@@ -49,9 +49,11 @@
|
|
|
BOOL _swipeGesturesEnabled;
|
|
|
NSString * panType;
|
|
|
UIView *_rootView;
|
|
|
+ UIView *_splashView;
|
|
|
UIPanGestureRecognizer *_panRecognizer;
|
|
|
UISwipeGestureRecognizer *_swipeRecognizerLeft;
|
|
|
UISwipeGestureRecognizer *_swipeRecognizerRight;
|
|
|
+ UITapGestureRecognizer *_tapRecognizer;
|
|
|
}
|
|
|
|
|
|
@property (nonatomic, strong) UIPopoverController *masterPopoverController;
|
|
@@ -69,6 +71,10 @@
|
|
|
|
|
|
- (void)dealloc
|
|
|
{
|
|
|
+ if (_splashView)
|
|
|
+ [_splashView removeFromSuperview];
|
|
|
+ if (_tapRecognizer)
|
|
|
+ [_rootView removeGestureRecognizer:_tapRecognizer];
|
|
|
if (_swipeRecognizerLeft)
|
|
|
[_rootView removeGestureRecognizer:_swipeRecognizerLeft];
|
|
|
if (_swipeRecognizerRight)
|
|
@@ -190,6 +196,8 @@
|
|
|
|
|
|
_swipeGesturesEnabled = YES;
|
|
|
if (_swipeGesturesEnabled) {
|
|
|
+ _tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognized)];
|
|
|
+ [_tapRecognizer setNumberOfTouchesRequired:2];
|
|
|
_panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panRecognized:)];
|
|
|
[_panRecognizer setMinimumNumberOfTouches:1];
|
|
|
[_panRecognizer setMaximumNumberOfTouches:1];
|
|
@@ -204,12 +212,14 @@
|
|
|
[_rootView addGestureRecognizer:_swipeRecognizerLeft];
|
|
|
[_rootView addGestureRecognizer:_swipeRecognizerRight];
|
|
|
[_rootView addGestureRecognizer:_panRecognizer];
|
|
|
+ [_rootView addGestureRecognizer:_tapRecognizer];
|
|
|
[_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerLeft];
|
|
|
[_panRecognizer requireGestureRecognizerToFail:_swipeRecognizerRight];
|
|
|
|
|
|
_panRecognizer.delegate = self;
|
|
|
_swipeRecognizerRight.delegate = self;
|
|
|
_swipeRecognizerLeft.delegate = self;
|
|
|
+ _tapRecognizer.delegate = self;
|
|
|
}
|
|
|
|
|
|
_aspectRatios = @[@"DEFAULT", @"FILL_TO_SCREEN", @"4:3", @"16:9", @"16:10", @"2.21:1"];
|
|
@@ -858,6 +868,21 @@
|
|
|
|
|
|
#pragma mark - multi-touch gestures
|
|
|
|
|
|
+- (void)tapRecognized
|
|
|
+{
|
|
|
+ if ([_mediaPlayer isPlaying]) {
|
|
|
+ [_mediaPlayer pause];
|
|
|
+ [self.statusLabel showStatusMessage:@" ▌▌"];
|
|
|
+ } else {
|
|
|
+ [_mediaPlayer play];
|
|
|
+ [self.statusLabel showStatusMessage:@" ►"];
|
|
|
+ }
|
|
|
+ [_rootView addSubview:_splashView];
|
|
|
+ [UIView animateWithDuration:1
|
|
|
+ animations:^{ _splashView.alpha = 0.0f;}
|
|
|
+ completion:^(BOOL finished){ [_splashView removeFromSuperview]; }];
|
|
|
+}
|
|
|
+
|
|
|
- (NSString*)detectPanTypeForPan:(UIPanGestureRecognizer*)panRecognizer
|
|
|
{
|
|
|
NSString * type;
|
|
@@ -950,6 +975,7 @@
|
|
|
}
|
|
|
|
|
|
if (swipeRecognizer.state == UIGestureRecognizerStateEnded) {
|
|
|
+ [_rootView addSubview:_splashView];
|
|
|
if ([_mediaPlayer isPlaying])
|
|
|
[_mediaPlayer play];
|
|
|
|