SingleTouch 和 MutliTouch
来源:互联网 发布:mysql创建存储过程例子 编辑:程序博客网 时间:2024/05/29 14:41
不论SingleTouch 还是 MutliTouch
self.view.userInteractionEnabled = YES; //交互首先要赋值为YES
SingleTouch
//touch开始时调用这个方法
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
}
//touch移动时调用这个方法
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
}
//touch结束时调用这个方法
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
}
//touch取消时调用这个方法
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
{
}
MutliTouch比如:2点touch
self.view.userInteractionEnabled = YES; //用户交互打开,这样touch才会有反应
self.view.multipleTouchEnabled = YES; //多点touch打开,不然只能识别Singletouch
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([touches count]==2) {
//获取2个touch点
NSArray *array_touches = [touches allObjects];
UITouch *touch1 = (UITouch *)array_touches[0];
UITouch *touch2 = (UITouch *)array_touches[1];
//利用touch点做一些事情
self.xLabel.center = [touch1 locationInView:self.view];
self.yLabel.center = [touch2 locationInView:self.view];
}
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if ([touches count]==2) {
//获取2个touch点
NSArray *array_touches = [touches allObjects];
UITouch *touch1 = (UITouch *)array_touches[0];
UITouch *touch2 = (UITouch *)array_touches[1];
}
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{ if ([touches count]==2) {
//代码
}
}
- SingleTouch 和 MutliTouch
- . 和 ->
- || 和&&
- .和::
- “?”和“!”
- #和##
- && 和 ||
- 、和
- #和##
- .//和..//
- 和
- ?和\?
- ./ 和 ../
- #和##
- #、和##
- #和##
- *和&
- <和>
- C++中的this指针
- codeforce round#261(Div2)
- arcengine 缓冲区查询 (ITopologicalOperator ISpatialFilter接口 )
- Hibernate3查询返回Map探秘
- webstorm快捷键大全
- SingleTouch 和 MutliTouch
- 遇到"ORA-39700: 必须用 UPGRADE 选项打开数据库"问题
- 使用 SQL 缓存依赖项,数据库缓存依赖 (附实例)
- .htaccess 的神奇之处
- hdoj 4932 Miaomiao's Geometry 【暴力枚举】
- Java VisualVM 监控远程机器
- oracle sql日期比较:
- Session(http://mynote.iteye.com/blog/1127469)
- XCode快捷键