iPad에서 PDF를 편집하는 앱을 제작하고 있습니다.iOS 11 PDF 주석이 주석 위치를 업데이트하지 않습니다
필자는 PDFView의 수퍼 뷰에 추가 한 panGesture 인식기로 주석을 드래그하여 구현하려고합니다. 문제는 주석의 새로운 rect 경계가 할당되지만 변경 사항이 화면에 반영되지 않는다는 것입니다.
@objc func handlePanGesture(panGesture: UIPanGestureRecognizer) {
let touchLocation = panGesture.location(in: pdfView)
guard let page = pdfView.page(for: touchLocation, nearest: true) else {
return
}
let locationOnPage = pdfView.convert(touchLocation, to: page)
switch panGesture.state {
case .began:
guard let annotation = page.annotation(at: locationOnPage) else {
return
}
currentlySelectedAnnotation = annotation
case .changed:
guard let annotation = currentlySelectedAnnotation else {
return
}
let initialBounds = annotation.bounds
annotation.bounds = CGRect(origin: locationOnPage,
size: initialBounds.size)
print("move to \(locationOnPage)")
case .ended, .cancelled, .failed:
break
default:
break
}
}
당신이 나를 도울 수 있기를 바랍니다 :
여기 내 코드입니다.