2010-12-19 63 views
0

我創建基於MVC模型中的ViewController一個對象:訪問另一個類的一個對象而委託

carArray = [[NSMutableArray alloc] init]; 
Car *aCar = [[Car alloc] init]; 
aCar.title = @"bla"; 
aCar.coordinate = CLLocationCordiante2DMake(123,123); 
[carArray addObject: aCar]; 
[aCar release]; 

現在我想從另一個視圖控制器B.我曾經試圖訪問我的阿卡爾對象合成包含我的汽車對象的視圖控制器A.但我總是得到這樣的信息:

請求會員aCar在一些不是結構或聯盟。

回答

1

您需要在ViewControllberB文件中包含ViewControllerA的頭文件,以便它知道ViewControllerA具有該屬性。