解决方案 »

  1.   

    创建一个UIView的子类,比如叫reportView,然后在这个类里实现touchesbegin方法
    之后在你的VC的self.view的第一层就加载和self.view一样frame的reportView,这样reportView里获取的坐标就都是全屏的了顺便给个touchbegin中获取坐标的语句
    CGPoint touchPos = [touch locationInView:self.view];
      

  2.   

    忘记说一句,你要把vc里其他的控件都加在reportView上,当然你也可以直接让vc的view从reportView继承
      

  3.   

    不知道你view的视图层级是怎样的。不过touchbegin方法应该会设置,方便的话上代码吧
      

  4.   

    找到最底层的view在获取坐标。
      

  5.   

    使用touchesBegan 方法挺好的,如果你是想获取相对手机屏幕的坐标,就使用相对appdelegate.window的坐标,这个是所有view最底层的父视图-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    //    UIWindow * window1 = (UIWindow *)self.view.superview;
    //    NSLog(@"%@",window1);
        AppDelegate * app = (AppDelegate *)[UIApplication sharedApplication].delegate;
        UIWindow * window2 = app.window;
        NSLog(@"%@",window2);
        
        UITouch * touch = touches.anyObject;
        CGPoint location2 = [touch locationInView:window2];
        NSLog(@"%@",NSStringFromCGPoint(location2));
    }
    就是状态栏点击没有效果。
      

  6.   

    可以按1楼给的方法去做。在
    -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
    里获取当前点击点的位置的方法
    UITouch * touch = touches.anyObject;
    CGPoint location2 = [touch locationInView:self];
      

  7.   

    是这样的 我的vc下 是个滑块选项卡,类似网易新闻那种。滑块选项卡下有两个view,我只需要在其中一个view实现这个方法。
    还有一点 不是很明白, 如你所说,我创建了一个你说的reportview,并且在上面放上了我的各种控件,但是这个reportview还是没有办法实现我点击控件上,就调用了reportview上得touchesbegin的方法。
    - -大神 有办法么
      

  8.   

    是这样的 我的vc下 是个滑块选项卡,类似网易新闻那种。滑块选项卡下有两个view,我只需要在其中一个view实现这个方法。
    还有一点 不是很明白, 如你所说,我创建了一个你说的reportview,并且在上面放上了我的各种控件,但是这个reportview还是没有办法实现我点击控件上,就调用了reportview上得touchesbegin的方法。
    - -大神 有办法么这个呢
      

  9.   

    如何找- -能详细点么你的试图都是加载在self.view上吧,一层一层的找,我以前遇到过这种问题,不知道一样不一样,我再做项目的时候,在tableview中用到过,你看看的试图的层次结构,有一个方法,一层层找最底层view的,在view controal里面用的。你找找