久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

iOS在mapview上刷新注釋

iOS refresh annotations on mapview(iOS在mapview上刷新注釋)
本文介紹了iOS在mapview上刷新注釋的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我有一個地圖視圖,其中注釋的坐標(biāo)不斷更新,但是當(dāng)我使用 setCoordinate 時,注釋不會移動.如何刷新注釋以反映它們的坐標(biāo)?

I have a mapview where the annotation's coordinates are constantly being updated but when I use setCoordinate, the annotation does not move. How do I refresh the annotations to reflect their coordinates?

- (void)updateUnits {

    PFQuery *query = [PFQuery queryWithClassName:@"devices"];
    [query whereKeyExists:@"location"];
    [query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {

        if (!error) {

            for (PFObject *row in objects) {

                PFGeoPoint *geoPoint = [row objectForKey:@"location"];
                CLLocationCoordinate2D coord = { geoPoint.latitude, geoPoint.longitude };

                for (id<MKAnnotation> ann in mapView.annotations) {

                    if ([ann.title isEqualToString:[row objectForKey:@"deviceid"]]) {

                        [ann setCoordinate:coord];

                        NSLog(@"latitude is: %f" , coord.latitude);
                        NSLog(@"Is called");
                        break;
                    }
                    else {

                        //[self.mapView removeAnnotation:ann];
                    }
                }
            }
        }
        else {

        }
    }];
}

推薦答案

更新(反映解決方案):

Updated (to reflect the solution):

擁有自己的自定義注釋并實現(xiàn) setCoordinate 和/或合成坐標(biāo)可能會導(dǎo)致問題.

Having your own custom annotations and implementing setCoordinate and/or synthesizing coordinate may cause issues.

來源:http://developer.apple.com/庫/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/AnnotatingMaps/AnnotatingMaps.html

以前的解決方案:

您可以簡單地刪除所有注釋,然后重新添加它們.

You can simply remove all of the annotations and then re-add them.

[mapView removeAnnotations:[mapView.annotations]];

[mapView addAnnotations:(NSArray *)];

或刪除它們并一一重新添加:

or remove them and re-add them one by one:

for (id<MKAnnotation> annotation in mapView.annotations)
{
    [mapView removeAnnotation:annotation];
    // change coordinates etc
    [mapView addAnnotation:annotation]; 
}

這篇關(guān)于iOS在mapview上刷新注釋的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Stop a UITableView from automatically scrolling(阻止 UITableView 自動滾動)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模擬器上運行時,使用 iOS 6.0 SDK 并為 iOS 5 Target 構(gòu)建會導(dǎo)致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創(chuàng)建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
UIImageView zoom and pinch in UIScrollView(UIImageView 在 UIScrollView 中縮放和捏合)
主站蜘蛛池模板: 亚洲综合久久精品 | 日韩成人影院在线观看 | 自拍中文字幕 | 一区二区视频 | 国产亚洲精品综合一区 | 成年无码av片在线 | 亚洲精品一区二区在线观看 | 日韩高清一区二区 | 国产精品久久久爽爽爽麻豆色哟哟 | 日韩精品一区二区三区中文在线 | 久久精品—区二区三区 | av在线视 | 日本一区二区三区四区 | 91观看| 一级a性色生活片久久毛片波多野 | 亚洲高清在线 | 亚洲成在线观看 | 中文字幕免费 | 黄色操视频| 日韩欧美国产精品 | 国产一区二区精品在线 | 妞干网福利视频 | 中文在线播放 | 天天澡天天操 | 国产aa| 亚洲一区二区三区视频免费观看 | 久久精品视频在线播放 | 日本成人中文字幕 | 伊人网在线看 | 成人一区二区三区视频 | 午夜羞羞| 欧美日韩久久 | 高清一区二区三区 | www.操.com| 日韩激情免费 | 日韩成人免费 | 一级毛片免费 | 国产精品久久久久久久久久免费看 | 欧美日韩网站 | 久久一二区 | 久久新视频|