Tuesday, 27 August 2013

Add Swipe Gesture to display the next Item in the Detailed View

Add Swipe Gesture to display the next Item in the Detailed View

From the Collection View I have passed the details I want via segue to the
Detailed View Controller.
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
SportsCollectionViewCell *selectedCell = (SportsCollectionViewCell *)sender;
SportsBrowserViewController *targetVC = (SportsBrowserViewController *)
[segue destinationViewController];
targetVC.targetURL = selectedCell.targetURL;
targetVC.sdesc = selectedCell.description.text;
targetVC.stitle = selectedCell.title.text;
targetVC.simage = selectedCell.image.image;
targetVC.scat = selectedCell.category.text;
targetVC.sdate = selectedCell.date.text;
}
I want to now add a swipe gesture to the destination view controller so
that I can get to the next article without having to go back to the main
page. I have added the following to set up the gesture.
UISwipeGestureRecognizer *recognizer;
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self
action:@selector(swipeHandler:)];
[recognizer setDirection:UISwipeGestureRecognizerDirectionLeft];
[[self view] addGestureRecognizer:recognizer];
}
-(IBAction)swipeHandler:(UISwipeGestureRecognizer *)sender{
NSLog(@"SWIPE");
}
However, I do not know how to move from here. Could someone point me in
the right direction.

No comments:

Post a Comment