0

是否可以在 MKMapPoint 中添加 uiview,我尝试过的代码如下所示,但它不起作用。任何帮助表示赞赏。


-(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];
}

谢谢。

4

1 回答 1

0
[yourmapview addSubview: mymapview];

像上面那样在地图视图上添加您的 mymapview。

于 2013-04-26T11:35:53.873 回答