首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

学习札记9—IOS触摸事件监听和操作

2012-08-15 
学习笔记9—IOS触摸事件监听和操作-(void)manageTouches:(NSSet *)touches{for (UITouch *touch in touches

学习笔记9—IOS触摸事件监听和操作

-(void)manageTouches:(NSSet *)touches{ for (UITouch *touch in touches) { switch (touch.phase) { caseUITouchPhaseBegan: NSLog(@"began..."); break; caseUITouchPhaseMoved: NSLog(@"move..."); break; caseUITouchPhaseEnded: NSLog(@"end..."); break; default: break; } }}

然后在ViewController中响应该方法:

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;


-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;


-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;


关于多点触摸,可以参考Apple IOS SDK开发文档,多点触摸在游戏及其一些新奇的应用中比较多,在常规的应用开发中还是比较少的用到多点触摸。


下次将介绍UIControl对象



热点排行