2012-09-20 10 views
5

我的理解是移動到iOS 6地圖沒有問題。但由於某種原因,細節披露按鈕現在在我的地圖應用程序中爲MISSING。有沒有辦法讓這回來。哇,完全出乎意料。這已經工作了多年,所以所有代表都很好。iOS6地圖,在我的所有地圖上隱藏細節披露按鈕(藍色雪佛龍)!如何讓它回到

#pragma mark MKMapViewDelegate 
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation { 

MKPinAnnotationView *pin = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"REUSEME"] autorelease]; 
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; 

if ([annotation isKindOfClass:[MKUserLocation class]]) { 
    pin.animatesDrop = YES; 
    return nil; 
} else { 
    [pin setPinColor:MKPinAnnotationColorGreen]; 
} 

pin.rightCalloutAccessoryView = button; 
pin.animatesDrop = YES; 
pin.canShowCallout = YES; 

return pin; 
} 
+0

我已經得到了這一點。發現如果我離開應用程序運行一段時間,將屏幕上的圖釘放大並重新顯示,再次顯示標註。似乎在兼容性方面存在一個錯誤,但是必須有一個訂單問題來解決它?如果我找到答案,我會發布答案! – sradforth

回答

0

我沒有這個問題,唯一的區別我可以在你的代碼之間看到和我是在創建MKPinAnnotationPinView對象,因爲我嘗試首先出列吧:

MKPinAnnotationView *pinView = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@"CustomPinAnnotationView"]; 
0

我有相同的問題,我使用相同的代碼作爲第一個答案:

MKPinAnnotationView * MyPin =(MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:@「MyPin」];

我還注意到,因爲在更新到xcode的4.5 /的iOS 6.

0

我在mapKit爲iOS 6已經注意到的是,所述定時是必要的其他問題。將MKMapView的委託設置爲延遲(即在viewDidLoad中),地圖將對已添加的註釋使用默認註釋樣式。 我的解決方案是將mapView.delegate = self移動到 - (void)loadView方法。

0

@ErCa根據iOS文檔,除非您構建自定義視圖,否則不應該調用loadView。

問題在於別處。我也有,一旦找到答案就會發佈一個答案。

@ ed-potter您是否定位iOS4?我問,因爲你自動釋放ARC不需要的MKPinAnnotationView。

0

這也發生在我身上。確實,由於某種原因,MKMapView委託需要設置爲比viewDidLoad更早。我最終做的是在我的setMapView:function中設置mapView委託。

因此,對於包含的MKMapView視圖控制器,我有以下屬性:

@屬性(非原子,弱)IBOutlet中的MKMapView * MapView的;

- (空)setMapView:

,所以我的setMapView函數內把(的MKMapView *)的MapView {

_mapView = mapView; 

self.mapView.delegate = self;//needed to move setting of the mapView delegate here because they changed when the viewForAnnotations delegate function is called when Apple went to iOS 6 and changed the maps App. Now all of the annotations are loaded and the views for those annotations are set up before the View Controller even calls viewDidLoad. 

[self updateMapView]; 

}

2

我有同樣的問題和設置Storyboard中的MapView委託爲我做了訣竅,標註箭頭現在正在工作:)

0

我有同樣的問題,並且還設置了self.mapView.delegate = selfviewDidLoadmapView:viewForAnnotation:沒有被調用,所以我的leftCalloutAccessoryView沒有得到我指定的UIImageView。我回去審查雷文德里希的Introduction to MapKit in iOS 6 Tutorial,發現這個:

首先選擇MainStoryboard.storyboard。然後將視圖控制器 (位於列表頂部)設置爲地圖視圖的代表 控制單擊地圖視圖,並將一行從 代表項拖到視圖控制器。

2

我有同樣的問題,我只把代表註釋後完美的工作!

mapView.delegate = self; 
[self.mapView addAnnotation:ann]; 

韓國社交協會, 考卡

相關問題