2013-04-26 93 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

相關問題