简体   繁体   中英

How to create my own custom map

I want to create my own simple map on iPhone application. all I want is to be able to implement pan and zoom on my own image (so it looks like a map) and to add pins on it.

If I didn't need to add pins, I could have just used a scroll view, but if I want to add pins - they need to move with the map, but keep their own size when zooming.

I'm not looking for tiles. I need to create only a small area, so I can use one photo only. I just need an idea for a way to create it.

An MKTilesOverlay is a simple overlay that starts with the world as one square at level 1 called 1.png in a folder called 1. 1/1/1.png When you zoom in a bit the world is drawn from four squares. The one in the top left is 1.png is a folder called 1 at level 2 2/1/1.png The one in the top right is also called 1.png but it is in a folder called 2 because it is the second column. 2/2/1.png The image in the bottom left is the second row of the first column of the second zoom level 2/1/2.png and the bottom right is the second row of the second column of the second zoom level 2/2/2.png

It goes on from there. So if you want your image be drawn over a map you'll need to cut it up into squares (note each one is the same number of pixels wide, usually 256/512) and make an MKTileOverlay. If you set the replacesMapContent flag on your overlay iOS will not try to load the map content. You may still see the compass though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM