首页 > 其他 > 详细

UI_触摸事件

时间:2015-07-03 14:03:44      阅读:225      评论:0      收藏:0      [点我收藏+]

基本触摸事件

 #pragma mark - 重写方法
 #pragma mark 触摸开始
 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
 {
 NSLog(@"touchesBegan");
 NSLog(@"%s",__FUNCTION__);
 }

 #pragma mark - 触摸移动
 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
 {
 NSLog(@"touchesMoved");
 NSLog(@"%s",__FUNCTION__);
 }

 #pragma mark - 触摸结束
 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
 {
 NSLog(@"touchesEnded");
 NSLog(@"%s",__FUNCTION__);


 CGFloat red = arc4random() % 256 / 255.0;
 CGFloat blue = arc4random() % 256 / 255.0;
 CGFloat green = arc4random() % 256 / 255.0;

 self.backgroundColor = [UIColor colorWithRed:red green:green blue:blue alpha:1.0];

 }

 #pragma mark - 触摸取消
 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
 {
 NSLog(@"touchesCancelled");
 NSLog(@"%s",__FUNCTION__);

 }

版权声明:本文为博主原创文章,未经博主允许不得转载。

UI_触摸事件

原文:http://blog.csdn.net/yadong_zhao/article/details/46740265

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!