判断某个点是否在某个view上

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

{

    UITouch *touch = [touches anyObject];

    CGPoint pt = [touch locationInView:self.view];

    

    if (!CGRectContainsPoint([self.view frame], pt)) {

        NSLog(@"pt不在self.view");

    }else{

        NSLog(@"ptself.View");

    }

}

posted @ 2014-11-12 18:56  糊涂人  阅读(828)  评论(0编辑  收藏  举报