ios - MKOverlayView and changing its alpha -
i have custom mkoverlay
, mkoverlayview
. when mkoverlayview
created, can set alpha
of view:
-(void)drawmaprect:(mkmaprect)maprect zoomscale:(mkzoomscale)zoomscale incontext:(cgcontextref)context { datasetoverlay *datasetoverlay = (datasetoverlay *)self.overlay; uiimage *image = [uiimage imagewithdata:datasetoverlay.imagedata]; cgimageref imagereference = image.cgimage; mkmaprect themaprect = [self.overlay boundingmaprect]; cgrect therect = [self rectformaprect:themaprect]; cgcontextscalectm(context, 1.0, -1.0); cgcontexttranslatectm(context, 0.0, -therect.size.height); cgcontextsetalpha(context, 1); cgcontextdrawimage(context, therect, imagereference); }
but want able change alpha
of view after draw.
how can that?
i have not worked core graphics yet.
-(void)drawmaprect:(mkmaprect)maprect zoomscale:(mkzoomscale)zoomscale incontext:(cgcontextref)context { dlog(@"fired"); datasetoverlay *datasetoverlay = (datasetoverlay *)self.overlay; uiimage *image = [uiimage imagewithdata:datasetoverlay.imagedata]; cgimageref imagereference = image.cgimage; mkmaprect themaprect = [self.overlay boundingmaprect]; cgrect therect = [self rectformaprect:themaprect]; cgcontextscalectm(context, 1.0, -1.0); cgcontexttranslatectm(context, 0.0, -therect.size.height); // cgcontextsetalpha(context, 1); cgcontextdrawimage(context, therect, imagereference); }
k, @ttarules's comment, did testing , realized needed remove cgcontextsetalpha()
, set alpha
mkoverlayview
's alpha property. can change alpha
outside of initialization , give me need.
Comments
Post a Comment