ios – Incorporate a PDF map in Swift app with panning, zooming, and tapping


I am looking for some assistance incorporating a PDF map of a metro system into my Swift UIKit app.

I have tried saving the PDF map as an asset and loading it into an ImageView. This behaves as expected with zooming (whether by pinch-to-zoom or double-tapping) and panning working flawlessly. However, the quality of the zoomed in image is degraded/blurry

I have tried loading the PDF map into the project files directly and calling upon it in a PDFView (via PDFKit). This fixes the blurriness, but there is a specific issue with panning I can’t seem to resolve. If I pan the zoomed map diagonally, it works as expected. If I pan the zoomed map vertically, it seems to lock the panning to a vertical axis until I release my finger. Likewise if I pan the zoomed map horizontally, it locks the panning to a horizontal axis until I release my finger. I have tried a WebView as well but it seems to have the same panning issue as the PDFView

Is there a way to implement this PDF map such that it behaves like the ImageView behavior I described, but maintains the sharpness/clarify as in the PDFView? I suppose I can convert the PDF into a high-quality PNG, but that would significantly increase the size of my app and I would like to avoid that if possible

I do also want to allow the user to access information about a tapped station in the future, so a method that allows for (eventually) retrieving tapped coordinates would be best. Thank you

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img