您好,我尝试在 MKPolygonView 中绘制文本。我创建了 MKPolygonView 的子类并将其添加到我的 MKMapView。多边形正确显示,但我看不到文本。谁能帮我?
-(void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context{
[super drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context];
CGRect overallCGRect = [self rectForMapRect:self.overlay.boundingMapRect];
UIFont* font = [UIFont fontWithName:@"ArialRoundedMTBold" size:20.0f];
NSString * t= @"Test";
[[UIColor redColor] set];
[t drawInRect:overallCGRect withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];
}