0
嘿傢伙。我有兩個類,SelectionScreenTable & GraphView。在類之間傳遞數組,不見了?
在SelectionScreenTable類.H,我宣佈一個NSMutableArray的叫usagedatas
NSMutableArray *usagedatas;
}
@property (nonatomic, retain) NSMutableArray *usagedatas;
在SelectionScreenTable class.m我記得@synthesize。 後來,在處理我的方法,我做了
NSLog(@"usagedatas count:%i",usagedatas.count);
,以檢查它是否具有價值,它返回1.所以是其良好了這一點。
而在 - (void)dealloc中,我記得要釋放它。
[usagedatas release];
因此,現在來試圖在另一個類中使用它。
在GraphView.m中,我導入了「SelectionScreenTable.h」。 在 - (無效)viewDidLoad中,我沒有
SelectionScreenTable *UD = [SelectionScreenTable alloc];
NSLog(@"GraphView UD.usagedataas.count = :%i",UD.usagedatas.count);
它返回0。
任何想法的傢伙?
忘了提及我試過 SelectionScreenTable * UD = [[SelectionScreenTable alloc] init]; 不能工作 – Kenneth 2010-06-17 09:55:25
在你顯示的代碼上,你只是創建一個屬性作爲指向數組的指針。你真的把這個屬性設置爲某個東西嗎?否則,它將是'nil','count'消息將返回0。 – pgb 2010-06-17 22:21:21