About

Big Bad Robots is an indie game developer but we also do contract development. We have developed on all kinds of platforms (PC,Handheld,Consoles) but now primarily focus on iOS,Android and Unity. Contact us if you looking for developers with over 20 years experience in software and game development at biz -at- bigbadrobots.com

iOS 7 Map Kit new MKOverlayRender Gotcha (delegate must be set in viewDidLoad)

November 13, 2013terence

I have working on a prototype App that uses the new iOS Map Kit Routing and Overlays and recently had to add the ability to draw a poly line between 2 annotated points. I know I had to:
1) Set the MapVIew delegate to point to my controller class
2) Implement a -(OverlayRender *) mapView:(MKMapView*) mapView rendererForOverlay:(id overlay method
3) In the method instantiate a MKPolylineRenderer

For some time I was scratching my head trying to figure why after doing all this, nothing was being draw. Until I realised the when you set the delegate for the map view you should do in in the controllers viewDidLoad method. Pretty simple because if you did it anywhere else, the MapKit has not been initialised.

Leave a Reply

Your email address will not be published. Required fields are marked *