iPhone SDK 3.2 手势识别
2010-02-08 01:34:00 来源:WEB开发网- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
// Disallow recognition of tap gestures in the segmented control.
if ((touch.view == segmentedControl) && (gestureRecognizer == tapRecognizer)) {
return NO;
}
return YES;
}
- (void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer {
CGPoint location = [recognizer locationInView:self.view];
[self showImageWithText:@"swipe" atPoint:location];
if (recognizer.direction == UISwipeGestureRecognizerDirectionLeft) {
location.x -= 220.0;
}
else {
location.x += 220.0;
}
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.55];
imageView.alpha = 0.0;
imageView.center = location;
[UIView commitAnimations];
}
- (void)handleRotationFrom:(UIRotationGestureRecognizer *)recognizer {
CGPoint location = [recognizer locationInView:self.view];
CGAffineTransform transform = CGAffineTransformMakeRotation([recognizer rotation]);
imageView.transform = transform;
[self showImageWithText:@"rotation" atPoint:location];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.65];
imageView.alpha = 0.0;
imageView.transform = CGAffineTransformIdentity;
[UIView commitAnimations];
}
- (void)handleTapFrom:(UITapGestureRecognizer *)recognizer {
CGPoint location = [recognizer locationInView:self.view];
[self showImageWithText:@"tap" atPoint:location];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
imageView.alpha = 0.0;
[UIView commitAnimations];
}
- ››手势识别兼容Android 1.x和2.x的代码
- ››iPhone应用帮助残障儿童看图说话
- ››iPhone实用工具AppBox Pro使用教程大揭秘
- ››iphone4省电方法
- ››iphone 获取地址的详细信息
- ››iPhone 库的基本内存管理策略
- ››iPhone加密文字亲手做 私密信息有保障
- ››iphone 根据经纬度坐标取详细地址(包括国,省,市...
- ››iphone/ipad ios cocoa object-c 近期苹果UI部分小...
- ››iphone中如何进行多线程编程
- ››iPhone OS SDK的这些事[安装、下载、版本、实例、...
- ››iPhone ObjectC的NSAutoreleasePool
更多精彩
赞助商链接