首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

怎么判断touch移动或离开视图

2012-08-17 
如何判断touch移动或离开视图- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{UITouch

如何判断touch移动或离开视图
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch=[touches anyObject];
    if (![self pointInside:[touch locationInView:self] withEvent:nil]) {
        NSLog(@"touches moved outside the view");
    }else {
        UIView *hitView=[self hitTest:[[touches anyObject] locationInView:self] withEvent:nil];
        if (hitView==self) {
            NSLog(@"touches moved in the view");
        }else{
            NSLog(@"touches moved in the subview");
        }
    }
}

热点排行