从集合视图中,我通过 segue 将我想要的详细信息传递给了详细视图控制器。
- (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;
}
我现在想向目标视图控制器添加一个滑动手势,这样我就可以进入下一篇文章而无需返回主页。我添加了以下内容来设置手势。
UISwipeGestureRecognizer *recognizer;
recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeHandler:)];
[recognizer setDirection:UISwipeGestureRecognizerDirectionLeft];
[[self view] addGestureRecognizer:recognizer];
}
-(IBAction)swipeHandler:(UISwipeGestureRecognizer *)sender{
NSLog(@"SWIPE");
}
但是,我不知道如何从这里移动。有人可以指出我正确的方向。