无法将UIBezierPath放到MKMapView上

时间:2012-08-23 00:30:11

标签: iphone objective-c ios

我有一个MKMap,除此之外,我有一个小传说。标签&图例内的图像成功显示在地图上方,但矩形/贝塞尔曲线本身不显示。 我已经尝试将其添加为子视图,但失败了。有办法解决这个问题吗?

我需要触摸仍然启用地图。

感谢。

- (void) drawRect:(CGRect)rect
{
    //TODO
        //Hover view for touching icons
        //Get rect on top of map as well
        //Border on frame
        //IsIpad slight larger frame/text/image
    int conX = [GeneralHelper GetCenteredXPosForObj:220 :self];
    int conY = 60;

    //Create box
    CGRect container = CGRectMake(conX, conY, 220, 50);
    UIBezierPath* path = [UIBezierPath bezierPathWithRoundedRect:container cornerRadius:5.0];
    [[UIColor blueColor] setFill];
    [path fillWithBlendMode:kCGBlendModeNormal alpha:0.7];
    //How to add to subview..?

    //NZPost image 38x37
    UIImageView *nzPostImageView = [[UIImageView alloc] initWithFrame:CGRectMake(conX + 20, conY+15, 25, 24)];
    [nzPostImageView setImage:[UIImage imageNamed:@"icon-map-post.png"]];
    [self addSubview:nzPostImageView];

    //NZPost label
    LegendLabel *postLabel = [[LegendLabel alloc] initWithFrame:CGRectMake(conX + 50, 78, conY, 15) ];
    postLabel.text = @"NZ post";
    [self addSubview: postLabel];

    //Incharge image 38x38
    UIImageView *inChargeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(conX + 120, conY+15, 25, 24)];
    [inChargeImageView setImage:[UIImage imageNamed:@"icon-map-incharge.png"]];
    [self addSubview:inChargeImageView];

    //Incharge label
    LegendLabel *inChargeLabel = [[LegendLabel alloc] initWithFrame:CGRectMake(conX + 150, conY+18, 60, 15) ];
    inChargeLabel.text = @"In charge";
    [self addSubview: inChargeLabel];


}

0 个答案:

没有答案