2011-03-15 9 views

答えて

2

ため

/*this function is made to handel finger gesture and flip the view to other account*/ 
-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ 



    FirstViewController *screen = [[FirstViewController alloc] initWithNibName:nil bundle:nil]; 

    screen.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    screen.myArray = myArray;  
    [self presentModalViewController:screen animated:YES]; 
    [screen release]; 

} 

おかげで、それは非常にあなたがトラップしたいかジェスチャーに依存します。シンプルなピンチ、スワイプタップなどの場合は、this documentに記載されているアップルの新しい(3.2)コンビニエンスクラスを使用してください。これらを使用して

、ジェスチャーをトラップすると、あなたのコードに次のようなものを追加するのと同じくらい簡単です:

UITapGestureRecognizer *doubleFingerDTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleDoubleTap:)]; 
doubleFingerDTap.numberOfTapsRequired = 2; 
[self.view addGestureRecognizer:doubleFingerDTap]; 

し、それが見つかったときにジェスチャーを処理するメソッドを実装する:

- (void)handleDoubleDoubleTap:(UIGestureRecognizer *)sender { 
     //Do something here 
} 

これはダブルタップをトラップします。

関連する問題