mkmapview - How to overlay MKPolyline on top of different maps -
mkmapview - How to overlay MKPolyline on top of different maps -
so draw mkpolyline users updated cllocationcoordinates per usual. when quits , starts again, of past points loaded onto mapview displayed
routeline = [mkpolyline polylinewithcoordinates:clcoordinates count:numberofsteps]; [_mapview addoverlay:routeline];
and in mkoverlayrenderer method have
if ([overlay iskindofclass:[mkpolyline class]]) { mkpolylinerenderer *renderer = [[mkpolylinerenderer alloc] initwithpolyline:overlay]; renderer.strokecolor = [[uicolor whitecolor] colorwithalphacomponent:0.7]; renderer.linewidth = 3; homecoming renderer; }
this works treat, problems arise when alter type of map with
[self resetmapviewandrasteroverlaydefaults]; [[uiapplication sharedapplication] setnetworkactivityindicatorvisible:yes]; _rasteroverlay = [[mbxrastertileoverlay alloc] initwithmapid:@"jonobolitho.j834jdml"]; _rasteroverlay.delegate = self; [_mapview addoverlay:_rasteroverlay];
note, have resetmapviewandrasteroverlaydefaults helper method
// reset mkmapview reasonable defaults. // _mapview.maptype = mkmaptypestandard; _mapview.zoomenabled = yes; [_mapview removeannotations:_rasteroverlay.markers]; [_mapview removeoverlay:_rasteroverlay]; [_rasteroverlay invalidateandcancel];
i using mbxmapkit display maps. maps display correctly, polyline isn't shown on top of map. map loads on top of polyline (routeline). know because in between tiles of new map can see routeline underneath.
so there way load mkpolyline maintain on top layer of map, if changes?
instead of:
[_mapview addoverlay:_rasteroverlay];
you want:
[_mapview insertoverlay:_rasteroverlay belowoverlay:routeline];
or similar. overlays have order.
mkmapview mapkit mapbox mkpolyline
Comments
Post a Comment