2013-04-26 88 views
0

是否可以在MKMapPoint中添加uiview,我试过的代码如下,但它不起作用。任何帮助表示赞赏。使用MKMapPoint将uiview作为子视图添加到MKmapview中


-(IBAction)foundTap:(UITapGestureRecognizer *)recognizer 
{ 
    CGPoint point = [recognizer locationInView:self.myMapView]; 

    CLLocationCoordinate2D tapPoint = [self.myMapView convertPoint:point toCoordinateFromView:self.view]; 

    MKMapPoint myMapPoint = MKMapPointForCoordinate(tapPoint); 

    UIView *mymapview=[[UIView alloc]initWithFrame:CGRectMake(myMapPoint.x, myMapPoint.y, 20, 20)]; 

    mymapview.backgroundColor=[UIColor greenColor]; 

    [self.view addSubview:mymapview]; 
} 

谢谢。

回答

0
[yourmapview addSubview: mymapview]; 

在地图上添加您的mymapview,就像上面一样。

+0

他说:不要将它添加到self.view,但在yourmapview – 2013-04-26 14:30:53

相关问题