Adding double finger double tap on stories to load Text.

This commit is contained in:
Samuel Clay 2014-02-05 17:14:23 -08:00
parent f129e8f12f
commit 7fa647a631
3 changed files with 25 additions and 12 deletions

View file

@ -688,8 +688,9 @@
0,
CGRectGetWidth(vb),
CGRectGetHeight(vb));
[self.originalViewController loadInitialStory];
}
[UIView animateWithDuration:.35 delay:0
options:UIViewAnimationOptionCurveEaseOut
animations:^
@ -711,9 +712,6 @@
self.originalViewController.view.frame = frame;
} completion:^(BOOL finished) {
self.interactiveOriginalTransition = NO;
if (resetLayout) {
[self.originalViewController loadInitialStory];
}
}];
}

View file

@ -95,7 +95,7 @@
initWithTarget:self action:@selector(handlePanGesture:)];
gesture.delegate = self;
[self.webView.scrollView addGestureRecognizer:gesture];
[self.webView loadHTMLString:@"" baseURL:nil];
}
@ -202,11 +202,13 @@
titleView.text = [[appDelegate activeStory] objectForKey:@"story_title"];
[titleView sizeToFit];
[MBProgressHUD hideHUDForView:self.webView animated:YES];
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.webView animated:YES];
HUD.labelText = @"On its way...";
[HUD hide:YES afterDelay:2];
HUD.userInteractionEnabled = NO;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.webView animated:YES];
MBProgressHUD *HUD = [MBProgressHUD showHUDAddedTo:self.webView animated:YES];
HUD.labelText = @"On its way...";
[HUD hide:YES afterDelay:2];
HUD.userInteractionEnabled = NO;
});
}
- (IBAction)webViewGoBack:(id)sender {

View file

@ -76,11 +76,19 @@
// [self.webView addGestureRecognizer:pinchGesture];
UITapGestureRecognizer *doubleTapGesture = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(showOriginalStory:)];
initWithTarget:self action:nil];
doubleTapGesture.numberOfTapsRequired = 2;
[self.webView addGestureRecognizer:doubleTapGesture];
doubleTapGesture.delegate = self;
UITapGestureRecognizer *doubleDoubleTapGesture = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:nil];
doubleDoubleTapGesture.numberOfTouchesRequired = 2;
doubleDoubleTapGesture.numberOfTapsRequired = 2;
[self.webView addGestureRecognizer:doubleDoubleTapGesture];
doubleDoubleTapGesture.delegate = self;
self.pageIndex = -2;
self.inTextView = NO;
}
@ -90,10 +98,15 @@
inDoubleTap = (touch.tapCount == 2);
return YES;
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
// NSLog(@"Gesture should multiple? %ld (%ld) - %d", gestureRecognizer.state, UIGestureRecognizerStateEnded, inDoubleTap);
if (gestureRecognizer.state == UIGestureRecognizerStateEnded && inDoubleTap) {
[self showOriginalStory:gestureRecognizer];
if (gestureRecognizer.numberOfTouches == 2) {
[self fetchTextView];
} else {
[self showOriginalStory:gestureRecognizer];
}
inDoubleTap = NO;
}
return YES;