标签:
1 //开始触摸 2 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 3 { 4 NSLog(@"你触摸了屏幕"); 5 } 6 //移动 7 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 8 { 9 NSLog(@"手指移动"); 10 } 11 //触摸结束 12 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 13 { 14 NSLog(@"触摸结束"); 15 } 16 //中断触摸 17 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 18 { 19 NSLog(@"中断触摸"); 20 } 21 //开始摇晃手机 22 - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event 23 { 24 NSLog(@"开始摇晃"); 25 } 26 //摇晃被中断 27 - (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event 28 { 29 NSLog(@"中断摇晃"); 30 } 31 //摇晃结束 32 - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event 33 { 34 NSLog(@"摇晃结束"); 35 }
新建一个Controller,可以通过添加以上的基本的方法来响应基本的一些事件。
标签:
原文地址:http://www.cnblogs.com/bishuai/p/5207523.html