gestureRecognizer

UITapGestureRecognizer* singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTap:)];
[self.view addGestureRecognizer:singleTap]; 
//这个可以加到任何控件上,比如你只想响应WebView,我正好填满整个屏幕
singleTap.delegate = self;
singleTap.cancelsTouchesInView
= NO;
[singleTap release];
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
return YES;
}

如果没有将自己赋值给UITapGestureRecognizer的委托,那么gestureRecognizer就不会被执行

posted @ 2011-09-21 21:24  Gang.Wang  阅读(346)  评论(0编辑  收藏  举报