Skip to content

Commit

Permalink
Weak-referenced UISwipeGestureRecognizer, restoring functionality wit…
Browse files Browse the repository at this point in the history
…h devices that don't support it (pre 3.2.x)
  • Loading branch information
peterhajas committed Mar 8, 2011
1 parent af01c28 commit 8489ae0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions MNAlertViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,19 @@ -(void)viewDidLoad
{
[super viewDidLoad];

// Single finger, double tap
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(didSwipeRight)];

swipeRight.numberOfTouchesRequired = 1;
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRight];
[swipeRight release];
//Thanks to a blog post by Marco Arment (http://www.marco.org/1648550153), we can support 3.x here.

if([UISwipeGestureRecognizer class] != nil)
{
// Single finger, double tap
UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(didSwipeRight)];

swipeRight.numberOfTouchesRequired = 1;
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
[self.view addGestureRecognizer:swipeRight];
[swipeRight release];
}
}

-(void)didSwipeRight
Expand Down
Binary file modified layout/Library/Application Support/.DS_Store
Binary file not shown.

0 comments on commit 8489ae0

Please sign in to comment.