2
我有一个自定义MKOverlay
和MKOverlayView
。当创建MKOverlayView
,我可以设置视图的alpha
:MKOverlayView并更改它的阿尔法
-(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);
}
但我希望能够更改视图的alpha
的平局之后。
我该怎么做?
我还没有很多Core Graphics的工作。
你是否继承了你的MKOverlay?如果是这样,[self setAlpha:.7]; – 2013-05-02 19:47:24
MKOverlay没有alpha属性。 – Padin215 2013-05-02 20:49:34
但MKOverlayView呢。 – Padin215 2013-05-02 20:55:08