MapKit Showcase

So I am now on this iOS project at work, that is centered around MapKit framework.  When the app starts you have a split view controller (this app is iPad only). On the left you have a table view and on the right is a map view. Each table view cell represents the location of one of many different types of custom annotations.  When you tap on a certain table view cell, (the mapview pans to the coordinate location of the annotation and a detailed view (a .xib file) is shown to show certain attributes about this annotation. While I cannot mention specifically the type of annotations are available, they are diverse.

What they want to do is have the capability to draw polygons around certain types of annotations and edit the polygons as needed. That’s where I come in. I have worked on iOS projects before using the MapKit framework but not specifically drawing shapes on the map, so this was a fun part of the framework to learn (I obviously don’t know every single method of the entire framework but I have a good feel for lots of it). Anyway, I started working on getting this functionality to work outside of the current project, just as a standalone test app to see how much I could get working/what I could get working before worrying about any integration into the current code base.

The way my code works, is that when you are in drawing mode, every single tap (recognizer) draws a MKCircle overlay at that coordinate and any subsequent tap draws a MKPolyLine overlay so that the user can clearly see what the polygon (MKPolygon) is going to look like. Obviously, with every tap, I update the MKPolyLine overlay accordingly. screenshot below:
Screenshot 2013.05.18 22.58.34Screenshot 2013.05.18 22.59.05Screenshot 2013.05.18 23.03.06When you are finished drawing the polygon you can tap “Done” and voila!… a new polygon has been created (MKPolygon overlay, yellow fill color, alpha of 0.4).

Screenshot 2013.05.18 23.08.33Below is a screenshot of two more polygons that I have added:

Screenshot 2013.05.18 23.16.02

If you expand the last image you will notice that some of the MKPolyLines appear to be jagged. I spent some time searching around to see what this was about and haven’t found an answer yet. If you know, please send me an e-mail or comment. Also, another thing that I have noticed, is that each time I add a new overlay to the map, the other overlays display some sort of “blinking” behavior. I wasn’t sure what was going on here but I did find a few questions about it in the apple dev forums and there seems to be an overlay bug with no solution as of yet. People seem to be claiming that it’s worse in iOS 6 than it was in iOS 5. Just a heads up.

To find out more of what I have accomplished so far, please head on over to the iOS page!

Leave a comment