在我的项目中,我有两种观点。一个是 homeViewController,另一个是 searchViewController。我在 homeViewController 上完成了向右滑动手势以显示 searchViewController。但UISwipeGestureRecognizerDirectionRight
对我不起作用。它给出了左动画而不是右动画。
我在 homeViewController.m 中添加了以下代码以添加手势属性并显示 SearchViewController:
UISwipeGestureRecognizer *swipeRecognizer=[[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeDetected:)];
[swipeRecognizer setDirection:UISwipeGestureRecognizerDirectionRight];
[self.view addGestureRecognizer:swipeRecognizer];
[swipeRecognizer release];
-(void)swipeDetected:(UIGestureRecognizer *)sender
{
SearchViewController *searchView=[[SearchViewController alloc] initWithNibName:@"SearchViewController" bundle:nil];
[self.navigationController pushViewController:searchView animated:YES];
[searchView release];
}
请帮帮我。谢谢。