我想在點擊地圖標註中的披露按鈕時加載另一個視圖。MapView標註上的細節披露按鈕將不會響應水龍頭
我使用添加按鈕標註在我AnnotationView實現文件的initWithAnnotation方法如下(我只顯示相關的代碼):
- (id)initWithAnnotation:(id<MKAnnotation>)annotation reuseIdentifier:(NSString *)reuseIdentifier
{
self.rightCalloutAccessoryView = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
}
我還增加了以下controllTapped方法對我的MapViewController執行文件,用於檢測揭示按鈕被竊聽的時間:
-(void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
{
DetailViewController *dvc = [[DetailViewController alloc] init];
[self.navigationController pushViewController:dvc animated:YES];
}
我還爲UI創建了一個帶有.XIB的新的detailedDisclosure類。這是我想在用戶點擊披露按鈕時加載的視圖。
那麼,當用戶點擊披露按鈕時,爲什麼沒有發生?
你是說我要用這個替換當前的公開按鈕語法嗎?在(id)initWithAnnotation ....方法中?此外,goToLocation括號中會包含什麼內容? pushViewController語法? – Cybernetic 2013-04-10 13:53:33