国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

iOS觸摸的位置放一個大頭針

2019-11-14 18:31:32
字體:
來源:轉載
供稿:網友

iOS 觸摸的位置放一個大頭針

UITapGestureRecognizer *mTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapPRess:)];  
    [self.mapView addGestureRecognizer:mTap];  

事件實現如下:
[cpp] view plaincopyprint?
- (void)tapPress:(UIGestureRecognizer*)gestureRecognizer {  
      
   

 

    CGPoint touchPoint = [gestureRecognizer locationInView:_mapView];//這里touchPoint是點擊的某點在地圖控件中的位置

    CLLocationCoordinate2D touchMapCoordinate =

    [_mapView convertPoint:touchPoint toCoordinateFromView:_mapView];//這里touchMapCoordinate就是該點的經緯度了

    

    NSLog(@"touching %f,%f",touchMapCoordinate.latitude,touchMapCoordinate.longitude);

    

        CLLocationCoordinate2D location=CLLocationCoordinate2DMake(touchMapCoordinate.latitude, touchMapCoordinate.longitude);

        KCAnnotation *annotation=[[KCAnnotation alloc]init];

        annotation.title=@"Kenshin&Kaoru";

        annotation.subtitle=@"Kenshin Cui's Home";

        annotation.coordinate=location;

        annotation.image=[UIImage imageNamed:@"icon_paopao_waterdrop_streetscape.png"];

        annotation.icon=[UIImage imageNamed:@"icon_mark2.png"];

        annotation.detail=@"Kenshin Cui...";

        annotation2.rate=[UIImage imageNamed:@"icon_Movie_Star_rating.png"];

        [_mapView addAnnotation:annotation2];

}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 阿克苏市| 五台县| 通化县| 长子县| 重庆市| 孙吴县| 河间市| 无锡市| 九寨沟县| 黔西县| 长治市| 塘沽区| 扶余县| 永丰县| 濉溪县| 巴青县| 贵定县| 瓮安县| 扶余县| 淳化县| 云安县| 无锡市| 安陆市| 绍兴县| 茌平县| 兴义市| 报价| 石首市| 旬邑县| 斗六市| 阿城市| 湖南省| 成都市| 长白| 长海县| 融水| 巴东县| 肥西县| 阳春市| 连南| 文水县|