当前位置: 移动技术网 > 移动技术>移动开发>IOS > iOS入门教程之UITouch解析

iOS入门教程之UITouch解析

2018年09月13日  | 移动技术网移动技术  | 我要评论

ios入门教程之uitouch解析。

//
//  viewcontroller.m
//  uitouch
//
//  created by hhg on 15/9/28.
//  copyright (c) 2015年 hhg. all rights reserved.
//

#import "viewcontroller.h"

@interface viewcontroller ()

@end

@implementation viewcontroller

- (void)viewdidload {
 [super viewdidload];

}

//刚点击
-(void)touchesbegan:(nsset *)touches withevent:(uievent *)event {

 uitouch * touch=[touches anyobject];
 cgpoint point=[touch locationinview:self.view];
 nslog(@"x = %fy = %f",point.x,point.y);

}

//事件打断
-(void)touchescancelled:(nsset *)touches withevent:(uievent *)event {
 nslog(@"事件打断");
}

//触摸结束
-(void)touchesended:(nsset *)touches withevent:(uievent *)event {
 nslog(@"触摸结束");
 uitouch * touch=[touches anyobject];
 cgpoint point=[touch locationinview:self.view];
 nslog(@"x = %fy = %f",point.x,point.y);

}

//触摸移动
-(void)touchesmoved:(nsset *)touches withevent:(uievent *)event {
 nslog(@"触摸移动");
 uitouch * touch=[touches anyobject];
 cgpoint point=[touch locationinview:self.view];
 nslog(@"x = %fy = %f",point.x,point.y);

}

- (void)didreceivememorywarning {
 [super didreceivememorywarning];
}

@end

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网