Please see below image:
As you can see, I added a mkpolyline
to my mkmapview
but because the route is to big so part of the route has been move behind the other subviews.
I want to make a change so that for all times, the positions of the poly-line be at bottom half of the map view(at below of the uitable
that shows step instructions). Is it possible?
You need to zoom the map view out in order to have the route displayed below the route text view(s). There are 2 ways to do that generally:
MKCoordinateRegion
(or MKMapRect
), which is the bounds of your route with extra padding space aboveMKMapView
frame such that it sits below the route text views and maintain a region
which fits the routeOption 2 is easier, but has a different visual effect. Option 1 requires you to pad the display area while maintaining the route display area.
For option 1, use the fact that you already zoom the map to the route and manipulate the visibleMapRect
. Try:
MKMapRect visibleMapRect = map.visibleMapRect;
visibleMapRect.origin.y = visibleMapRect.size.height;
visibleMapRect.size.height *= 2;
map.visibleMapRect = visibleMapRect;