我有子类MKAnnotationView创建基本借鉴了通过drawRect中的覆盖地图视图点周围一圈的注释。圆在以下情况下绘制细(在模拟器):MKAnnotationView消失上刷卡并双击缩放
- 在地图视图
- 在滑动的初始负荷,但只有当滑动运动之前触摸端部,使得地图不停止( “海岸”触摸结束后)
- 在双指缩放
时有下列行为的发生,该圆圈将消失:
- 刷卡其中图“海岸”触摸结束后
- 双击缩放如果有的话,在“工作”组的行动已经消失后,采取
的圆圈会重新出现。
什么可能导致这种情况?我不是一个绘图/显示/布局专家(坦率地说,我不是一个obj C或iPhone专家)。
下面是一些稍微简化代码,似乎最相关的从我的MKAnnotationView子类:
- (void)drawRect:(CGRect)rect {
// Drawing code
[self drawCircleAtPoint:CGPointMake(0,0) withRadius:self.radiusInPixels andColor:self.circleAnnotation.color];
}
- (void)drawCircleAtPoint:(CGPoint)p withRadius:(int)r {
CGContextRef contextRef = UIGraphicsGetCurrentContext();
float alpha = 0.75;
CGContextSetRGBFillColor(contextRef, 255, 0, 0, alpha);
CGContextSetRGBStrokeColor(contextRef, 255, 0, 0, alpha);
// Draw a circle (border only)
CGContextStrokeEllipseInRect(contextRef, CGRectMake(0, 0, 2*r, 2*r));
}
也看到这种行为,寻找解决的办法可以找到... – 2010-02-25 08:36:32
甚至我面临同样的问题,有没有运气? – Ameya 2010-08-29 12:24:39
是在“非”工作组中调用的drawRect? – Magnus 2011-01-13 08:29:44