我得到一個MKLocalSearch
的結果,它包括像...MKMapItem沒有顯示正確的信息在MKPlacemark
{
address = {
formattedAddressLine = (
"Marton Road",
Middlesbrough,
TS1,
England
);
structuredAddress = {
administrativeArea = England;
areaOfInterest = (
"Great Britain"
);
country = "United Kingdom";
countryCode = GB;
fullThoroughfare = "Marton Road";
geoId = (
);
locality = Middlesbrough;
postCode = TS1;
subAdministrativeArea = Middlesbrough;
thoroughfare = "Marton Road";
};
};
addressGeocodeAccuracy = 0;
business = (
{
UID = 9301704419119613323;
URL = "http://www.cineworld.co.uk";
attribution = (
{
attributionURLs = (
"yelp5.3:///biz/cineworld-middlesbrough",
"yelp4:///biz/cineworld-middlesbrough",
"yelp:///biz/cineworld-middlesbrough",
"http://yelp.com/biz/cineworld-middlesbrough"
);
sourceIdentifier = "com.yelp";
sourceVersion = 1;
}
);
canBeCorrectedByBusinessOwner = 1;
name = Cineworld;
source = (
{
"source_id" = "b2LOPag6ha6845__dgXehw";
"source_name" = yelp;
},
{
"source_id" = 6670;
"source_name" = tribune;
},
{
"source_id" = 2000000103009680;
"source_name" = "acxiom_intl";
},
{
"source_id" = "cineworld-middlesbrough";
"source_name" = "yelp_alias";
}
);
"star_rating" = (
0
);
telephone = "+448712002000";
}
);
center = {
lat = "54.57633773904653";
lng = "-1.228197113614671";
};
inputLanguage = en;
localSearchProviderID = 9902;
mapRegion = {
eastLng = "-1.224891596539819";
northLat = "54.57545000290778";
southLat = "54.5738619816233";
westLng = "-1.227631256834202";
};
name = Cineworld;
type = 57;
}
現在,當我...把它添加到我的地圖
id <MKAnnotation> annotation = mapItem.placemark;
[self.mapView addAnnotation:annotation];
它增加了一個別針,當我點擊它時顯示「Marton Road」,但我希望它顯示「Cineworld」。
雖然我發現很難找到關於從MKMapItem
和MKPlacemark
中獲取東西的任何信息。
如果我嘗試在地點標記中使用mapItem.name
,那麼它們都會顯示「美國」。
任何想法如何從中獲得更多有用的信息?
這可能是一個註釋重用問題。您能否顯示您在 - (MKAnnotationView *)中使用的代碼mapView:(MKMapView *)map viewForAnnotation:(id)註釋{}? –
Mike
2014-08-27 17:04:31
我沒有使用它。從字面上看,上面的兩條線都是我用來在地圖上放置針腳的。 – Fogmeister 2014-08-27 19:17:30
我會仔細研究一下,比如UITableViewCells,地圖視圖的重用註釋以及任何出現的重複/不正確信息通常是由重用問題引起的。 – Mike 2014-08-27 19:18:53