ios - Does MKOverlayPathView need drawMapRect? -
i'm having inconsistencies modifying breadcrumb example, have crumbpathview subclassed mkoverlaypathview (like it's supposed to) rather subclassed mkoverlayview.
trouble is, docs limited in stating difference in how these 2 should implemented. subclass of mkoverlaypathview it's advised use:
- createpath - applystrokepropertiestocontext:atzoomscale: - strokepath:incontext:
but in place of drawmaprect, or in addition to? doesn't seem point if it's in addition to, because both used similar implementations. using instead of drawmaprect, leaves line choppy , broken.
struggling find real world examples of subclassing mkoverlaypathview too...is there point?
update - modified code drawmaprect, should work:
- (void)createpath { crumbpath *crumbs = (crumbpath *)(self.overlay); cgmutablepathref newpath = [self createpathforpoints:crumbs.points pointcount:crumbs.pointcount]; if (newpath != nil) { cgpathaddpath(newpath, null, self.path); [self setpath:newpath]; } cgpathrelease(newpath); } - (void)applystrokepropertiestocontext:(cgcontextref)context atzoomscale:(mkzoomscale)zoomscale { cgcontextsetstrokecolorwithcolor(context, [[uicolor greencolor] cgcolor]); cgfloat linewidth = mkroadwidthatzoomscale(zoomscale); cgcontextsetlinewidth(context, linewidth); cgcontextsetlinejoin(context, kcglinejoinround); cgcontextsetlinecap(context, kcglinecapround); } - (void)strokepath:(cgpathref)path incontext:(cgcontextref)context { cgcontextaddpath(context, path); cgcontextstrokepath(context); [self setpath:path]; }
this draws initial line, fails continue line...it doesn't add path. i've confirmed applystrokepropertiestocontext , strokepath getting called, upon every new location.
here's screenshot of broken line results (it draws createpath, not after that):
here's screenshot of "choppy" path happens when drawmaprect included createpath:
without having seen more of code i'm guessing, here goes.
i suspect path being broken segments, a->b, c->d, e->f rather path points a,b,c,d, e , f. sure of we'd need see happening self.overlay
, whether being reset @ point.
in strokepath
set self.path
1 being stroked. doubt idea since stroking happen @ time viewforannotations
.
as choppiness may side effect or poor bounds calculation on apple's part. if ends near boundary of tile apple uses cover map prompt map draw 1 line within. stroke width extends neighbouring tile hasn't been draw. i'm guessing again test out moving point north of w in "queen st w" fraction south, or increasing stroke width , see if cut off line stays in same place geographically.
Comments
Post a Comment