点击屏幕 获得屏幕坐标ios

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

{
    
    UITouch *touch = [touches anyObject];
    
    CGPoint touchPoint = [touch locationInView:self.view];
    
    NSLog(@"%f==%f",touchPoint.x,touchPoint.y);
    int stringFloat = (int)(touchPoint.x);
    int stringFloat1 = (int)(touchPoint.y);
    NSLog(@"%i%i",stringFloat,stringFloat1);
    
    
    //touchPoint.x ,touchPoint.y 就是触点的坐标。
    
    
    
}

posted on 2012-08-09 16:34  爱直至成伤lie  阅读(11827)  评论(0编辑  收藏  举报