Browse files

Added demo of panningGestureDelegate to MultiViewDeckExample.

  • Loading branch information...
1 parent 9ff9433 commit 1c5f8ecd2ca6f14e6ba4e135252e25e72c5c8247 @Inferis Inferis committed Aug 2, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 MultiViewDeckExample/MultiViewDeckExample/CenterViewController.m
View
11 MultiViewDeckExample/MultiViewDeckExample/CenterViewController.m
@@ -11,11 +11,11 @@
#import "IIViewDeckController.h"
#import "ModalViewController.h"
-@interface CenterViewController ()
+@interface CenterViewController () <UIGestureRecognizerDelegate>
@end
-@implementation CenterViewController
+@implementation CenterViewController
- (id)initWithStyle:(UITableViewStyle)style
{
@@ -30,10 +30,16 @@ - (void)viewDidLoad
{
[super viewDidLoad];
+ self.viewDeckController.panningGestureDelegate = self;
+
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRewind target:self.viewDeckController action:@selector(toggleLeftView)];
self.navigationController.navigationBar.tintColor = [UIColor purpleColor];
}
+- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
+ NSIndexPath* indexPath = [self.tableView indexPathForRowAtPoint:[gestureRecognizer locationInView:self.tableView]];
+ return indexPath.section < 2;
+}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
@@ -73,6 +79,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
UITableViewCell *cell = [UITableViewCell tableViewAutoDequeueCell:tableView];
cell.textLabel.text = indexPath.section % 2 ? @"Close Me" : @"Modal";
+ cell.textLabel.text = [cell.textLabel.text stringByAppendingString:indexPath.section >= 2 ? @" (no pan)" : @""];
return cell;
}

0 comments on commit 1c5f8ec

Please sign in to comment.