现在的位置: 首页 > 综合 > 正文

Touch

2018年05月25日 ⁄ 综合 ⁄ 共 785字 ⁄ 字号 评论关闭
///获取touch位置
 CGPoint touchPoint=[touch locationInView:self.view];
    NSString *str=[NSString stringWithFormat:@"%f",touchPoint.x];
    myLabel.text =str;

// handle new touches
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    myLabel.text =@"touch";

    [self processTouch:[touches anyObject]];
} // end method touchesBegan:withEvent:
-(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
//当触摸序列被诸如电话呼入这样的系统事件所取消时,发送touchesCancelled:withEvent:消息。
{
    myLabel.text=@"cancelles";
}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    myLabel.text=@"ended";
}
// exactly the same as touchesBegan:withEvent: minus double-tapping
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    myLabel.text=@"move";
   [self processTouch:[touches anyObject]];
} // end method touchesMoved:withEvent:

【上篇】
【下篇】

抱歉!评论已关闭.