0
IOS에서 사용자가 화면을 집 어서 내 캔버스를 확대하려고합니다.그래픽 컨텍스트에서 피벗 값을 기준으로 한 배율 확대
여기 (작동) 안드로이드에서 내 코드를 변환 snift의 오전 :
이focusX = gestureDetector.getFocusX();
focusY = gestureDetector.getFocusY();
enter code herecanvas.scale(mScaleFactor,mScaleFactor,focusX,focusY);
내 번역 IOS 코드가 같은 결과를 제공하지 않습니다
- (void)onScale:(UIPinchGestureRecognizer *)gesture
{
if (gesture.state == UIGestureRecognizerStateBegan) {
CGPoint endPoint = [gesture locationInView:self];
focusX = endPoint.x;
focusY = endPoint.y;
}
}
CGContextTranslateCTM(UIGraphicsGetCurrentContext(), focusX, focusY);
CGContextScaleCTM(UIGraphicsGetCurrentContext(), mScaleFactor, mScaleFactor)
이유는 무엇입니까?
여기에 일부 코드를 게시 할 수 있습니다. 일반적으로 CGContextTranslateCTM과 CGContextScaleCTM이 작업을 수행해야합니다. 너는 뭔가를 놓칠지도 모른다. – demosten