0
PDFKIT를 사용하여 PDF에 선을 그립니다. 다음과 같이 내가 접촉이 시작 오버라이드 (override)는 pdfView의 documentView 내 터치를 기록하는 등 다음과 같이 이동 :다른 좌표계를 사용하여 PDF에 주석 달기
override func touchesMoved(_ touches: Set<UITouch>,
with event: UIEvent?) {
// 6
swiped = true
if let touch = touches.first {
let currentPoint = touch.location(in: pdfView.documentView)
drawLineFrom(fromPoint: lastPoint, toPoint: currentPoint)
addAnnotation(fromPoint: lastPoint, toPoint: currentPoint)
// 7
lastPoint = currentPoint
}
}
을하지만, 당신이 아래에있는 내 이미지에서 볼 수 있듯이 나는 화면과 빨간색을 만지지 곳 (검은 선은 선은 주석이 그려지는 곳입니다.) 접촉 좌표계는 화면의 왼쪽 상단에서 (0,0)이고 pdf는 화면의 왼쪽 하단 (0,0)에서 주석을 달았습니다.
func addAnnotation(fromPoint: CGPoint, toPoint: CGPoint) {
let page = pdfView.document?.page(at: 0)
let bounds = CGRect(x: 0, y: 0, width: 600, height: 600)
let line = PDFAnnotation(bounds: bounds, forType: .line, withProperties: nil)
line.startPoint = fromPoint
line.endPoint = toPoint
line.startLineStyle = .none
line.endLineStyle = .none
line.color = .red
let border = PDFBorder()
border.lineWidth = 4.0
line.border = border
page?.addAnnotation(line)
}
가 어떻게 주석이 그려 어디 화면에 터치 장소입니다 있도록 좌표계를 정렬 할 수 있습니다 다음과 같이
내 추가 주석 기능은 무엇입니까?