2013-01-17 51 views
0

我想將導航推入滑動。如何通過滑動瀏覽器以編程方式切換viewcontrollers?

我想在滑動手勢上調用此方法。

- (IBAction)MakeADifferenceButtonPressed:(id)sender { 
    MakeADifferenceViewController *makeADifferenceView = [[MakeADifferenceViewController alloc] initWithNibName:@"MakeADifferenceViewController" bundle:nil]; 
    [self.navigationController pushViewController:makeADifferenceView animated:YES]; 
    [makeADifferenceView release]; 
} 

任何人請幫助我。我是iphone新手。

回答

2

使用此代碼來添加UISwipeGestureRecognizerDirectionLeft在你目前的UIView

UISwipeGestureRecognizer *swipeleft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(MakeADifferenceButtonPressed:)]; 
swipeleft.direction = UISwipeGestureRecognizerDirectionLeft; 
[self.view addGestureRecognizer:swipeleft]; 
+0

太感謝你了。 – ani

相關問題