我是iPhone編程的新手,我正在練習MKMapView.But,它顯示的是未被佔用的數據。 我有兩個ViewControllers。在第一個ViewController中,我們有一個按鈕,其下面寫有以下編碼: - 有兩個陣列,其數據如下所示: - DetailArray: - inNetwork = true;MapView顯示無法匹配的數據?
resName = taverna1;
statusColor = "#FF0000";
statusString = "30 MIN";
true = hasPromo;
},
{
false = hasPromo;
inNetwork = true;
resName = bungalow;
statusColor = 00FF00;
statusString = "NO WAIT";
},
{
inNetwork = true;
resName = "casa_nostra";
statusColor = 00FF00;
statusString = "NO WAIT";
true = hasPromo;
},
{
inNetwork = true;
resName = karebu;
statusColor = 00FF00;
statusString = "NO WAIT";
true = hasPromo;
}
**Annotation Array**
(
"<MyAnnotViewController: 0x8457b60>",
"<MyAnnotViewController: 0x845a040>",
"<MyAnnotViewController: 0x84439f0>",
"<MyAnnotViewController: 0x806f090>"
)
MyAnnoationViewcontroller是MKAnnotation的子類,它成功包含標題和座標。
SecondViewController *_SecondViewController =[[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil];
_SecondViewController.DetailArray = detailArray;
_SecondViewController.annotationArray = annotationArray;
[self.navigationController pushViewController:_SecondViewController animated:YES];
在secondViewController: -
MKMapView * MapView =[[MKMapView alloc]initWithFrame:CGRectMake(0, 0, 320, 415)];
MapView.delegate =self;
MapView.showsUserLocation =NO;
[MapView addAnnotations:annotationArray];
[self.view addSubview:MapView];
的委託方法它顯示在annotations.Chlorinates非常不確定的結果和標題所需的輸出。但第一個休息名稱的顏色顯示第二個餐廳的顏色,第二個顯示任何其他顏色。請有人幫我解決這個問題。幫助將不勝感激。