欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

iOS入门教程之UITouch解析

程序员文章站 2022-05-16 20:33:58
ios入门教程之uitouch解析。 // // viewcontroller.m // uitouch // // created by hhg on 15/9/28. //...

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