From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

Maps and auto zoom

Maps and auto zoom

- [Instructor] When adding map overlays, you may run into a small problem. Take a look at this UIkit app, for example. I have a button to show a walking path on a map, however, when I press that button, you could see the path but it's really small. What I'd like to do is zoom in on this area automatically so that I can see just the walking path and get more detail. Now, fortunately, MKMapRects make this rather simple. So I'm going to go ahead and stop this app now and we're going to go into the code here and I can show you quickly what's going on here in the WalkingPath. When I hit the button, it fires a method addWalkingPath, which is down here and that creates from some coordinates I have stuck up here a path. And this is pretty much straight forward code as far as an overlay is concerned. Now, one important detail here is I make sure I remove all the old overlays first every time I hit it, so I'm sure that this is…

Contents