0
我有一張基於用戶位置顯示各種引腳的地圖。我可以查看引腳和標註沒有問題。當我按下詳細披露按鈕時,我的MapDetailInfo不會加載。這是一些代碼。註解詳細視圖無法在Mapkit中加載
- (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation
{
// Specify which MKPinAnnotationView to use for each annotation.
MKPinAnnotationView *businessListingPin = (MKPinAnnotationView *)[self.mapView dequeueReusableAnnotationViewWithIdentifier: @"BLPin" ];
if (businessListingPin == nil)
{
businessListingPin = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"BLPin"];
}
else
{
businessListingPin.annotation = annotation;
}
// If the annotation is the user's location, don't show the callout and change the pin color
if(annotation == self.mapView.userLocation)
{
businessListingPin.canShowCallout = NO;
businessListingPin.pinColor = MKPinAnnotationColorRed;
}
else
{
businessListingPin.canShowCallout = YES;
businessListingPin.pinColor = MKPinAnnotationColorPurple;
businessListingPin.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
}
return businessListingPin;
}
- (void)mapView:(MKMapView *)mapView
annotationView:(MKAnnotationView *)view
calloutAccessoryControlTapped:(UIControl *)control
{
MapDetailInfo *abc = [[MapDetailInfo alloc]init];
UINavigationController *nav = [[UINavigationController alloc] init];
[nav pushViewController:abc animated:YES];
}
不確定是否重要,但這是標籤欄應用程序的一部分。任何幫助將非常感激。謝謝!
明白了......我已經把導航控制器的每個選項卡上....我想我不確定如何將新的VC推到該導航控制器上(對不起,我對此仍然很陌生)......謝謝! – ADZBOT
[self.navigationController pushViewController:abc]我想..你的地圖VC應該有一個引用它自己的導航控制器 –
得到它的工作。謝謝!我有viewControllers有點混淆。做了一些重新排序和它的工作。 – ADZBOT