1

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.

Amit Hagin
  • 3,136
  • 6
  • 26
  • 36
  • Looks like you want to do this: http://stackoverflow.com/questions/13404103/how-to-make-a-map-like-view-that-has-a-custom-map-image Unfortunately none of the solutions really work, those 3rd party tools are all web-based/html5. Let's see if we can get an answer! – brandonscript Dec 23 '13 at 16:57

1 Answers1

2

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.

Craig
  • 8,093
  • 8
  • 42
  • 74
  • I edited my question: I don't need a tile solution. one image is enough. Though your answer is interesting, so I'm checking it anyway. – Amit Hagin Dec 23 '13 at 19:35
  • If the image is so large people have to move it about then it's large enough to need to zoom in and out, hence the need for tiles. Without tiles the zoomed in view could be pixelated, or the zoomed out view would be one massive image that is inefficient for panning around. How big (pixel width) is the image? – Craig Dec 23 '13 at 19:51
  • about 6 times the screen – Amit Hagin Dec 23 '13 at 19:58
  • That's a pretty large image. Try it out as one single overlay but try it on the slowest device you're targeting (all app submissions as of February need to be iOS 7 optimized so iPhone4+ I think) and see if it is still useable. – Craig Dec 23 '13 at 20:54