2010-04-18 79 views
1

我有一個詳細視圖,其中包含三個UIButton,每個UIButton將不同視圖推入堆棧。其中一個按鈕連接到MKMapView。當按下該按鈕時,我需要將詳細視圖中的緯度和經度變量發送到地圖視圖。我想補充的IBAction爲字符串聲明:無法將變量從一個視圖傳遞到另一個視圖

- (IBAction)goToMapView { 

MapViewController *mapController = [[MapViewController alloc] initWithNibName:@"MapViewController" bundle:nil]; 

mapController.address = self.address; 
mapController.Title = self.Title; 
mapController.lat = self.lat; 
mapController.lng = self.lng; 

//Push the new view on the stack 
[[self navigationController] pushViewController:mapController animated:YES]; 
[mapController release]; 
mapController = nil; 

}

但是我得到這個當我嘗試建立:「錯誤:不兼容的類型分配」兩個緯度和經度變量。所以我的問題是關於如何將正確的方式從一個視圖傳遞給另一個視圖?而且MKMapView是以字符串還是數字的形式接受經緯度?

回答

0

你似乎做得很好,但正如編譯器錯誤所說,你的變量有不兼容的類型。確保self.latmapController.lat具有相同的類型(對於lng變量相同)。

相關問題