那麼即時通訊新的目標C它的第二週試圖去適應它,它進行得很好,但我有點卡住了,我已經在互聯網上收到了很多有關這個問題的文章,但沒有工作...在不同的類中使用NSMutablearray
我正在開發一個ipad/splitview。我有一個rootviewcontroller,我填寫一個NSmutablearray
靜態和動態,並返回他們在導航欄上的表格,這完美的作品。 而我有一個detailviewvcontroller我也想要訪問rootviewcontroller的這個NSMutablearray。我可以訪問該數組,但其中沒有對象(但其中有對象,否則導航欄將爲空)。
我有這個至今: Rootviewcontoller.h
@class DetailViewController;
@interface RootViewController : UITableViewController {
NSMutableArray *listoflinks;
}
@property (nonatomic,retain) NSMutableArray *listoflinks;
@end
i also synthesize the array, no problem in this class..
DetailviewController.h
@interface DetailViewController : UIViewController <UIPopoverControllerDelegate, UISplitViewControllerDelegate,UIPickerViewDataSource,UIPickerViewDelegate> {
RootViewController *objRootViewController;}
@property(nonatomic,assign) RootViewController *objRootViewController;
@end
我也能合成類的對象在detailviewcontroller.m文件 當我使用objRootViewController.listoflinks到一個控制器它不會返回annything ..我也試圖通過m在detailviewcontroller.m中使用與我爲listoflinks創建的相同屬性創建一個NSMutablearray,並且這個工作原理..所以問題是從另一個類獲取數組的值,
請記住,這些頭文件,但我沒有添加它們,因爲它們與數組無關。
更多信息:http://getsetgames.com/2009/08/30/the-objective-c-singleton/ – 2011-05-05 07:48:13