Iphone 点对像素

Iphone 点对像素,iphone,ipad,pixel,cgpoint,Iphone,Ipad,Pixel,Cgpoint,我有一个视图,可以放大和缩小 我将其与Pinchre认知测量相关联,使用 pinchRecognizerMeasure = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(MeasureAndDraw:)]; [pinchRecognizerMeasure setDelegate:self]; [DrawLine addGestureRecognizer:pinchRecognizerMeasure];

我有一个视图,可以放大和缩小

我将其与Pinchre认知测量相关联,使用

pinchRecognizerMeasure = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(MeasureAndDraw:)];
[pinchRecognizerMeasure setDelegate:self];
[DrawLine addGestureRecognizer:pinchRecognizerMeasure];
[pinchRecognizerMeasure release];
测量代码ADDRAW

    // get position of touches, for example:
    NSUInteger num_touches = [pinchRecognizerMeasure numberOfTouches];

    // save locations to some instance variables, like `CGPoint location1, location2;`
    if (num_touches >= 1) {

        DrawLine.startPoint = [pinchRecognizerMeasure locationOfTouch:0 inView:DrawLine];
    }
    if (num_touches >= 2) {

        DrawLine.endPoint = [pinchRecognizerMeasure locationOfTouch:1 inView:DrawLine];
    }
起点,终点是CGPoint,我想得到它的等效像素

我该怎么办像这样做对吗

startPoint.X*DrawLine.contentScaleFactor获取pixl X坐标,或者我该怎么做

我读了,但是弄糊涂了


任何建议

如果确实需要,请查看的
contentScaleFactor
属性,以便在设备上的点和像素之间进行转换。

为什么您认为需要像素?大多数情况下,这是你需要的点。看看他的,他希望能够通过使用他用像素表示的刻度将像素长度转换为实际长度来测量线长度。但在iOS中,点不一定是像素。