これはoften asked question hereです。 MVC design patternをご覧ください。あなたの辞書はこのシナリオではモデルになり、それにアクセスする必要があるすべてのコントローラー/ビューには独自のプロパティが必要です。読み込みは、プログレスバーを持つ別のコントローラ/ビュー、アプリケーションデリゲート、または最初のタブで行うことができます。あなたの状況によって異なります。
クラスは、ビットのようになります。
@interface Model : NSObject {…}
- (void) load;
@end
@interface ControllerA : UIViewController {…}
@property(retain) Model *model;
@end
@interface ControllerB : UIViewController {…}
@property(retain) Model *model;
@end
@implementation ApplicationDelegate
- (void) applicationDidFinishLaunchingAndWhateverElseIsUsuallyHere
{
Model *model = [[Model alloc] init];
[model load];
ControllerA *controllerA = [[ControllerA alloc] init…];
[controllerA setModel:model];
ControllerB *controllerB = [[ControllerB alloc] init…];
[controllerB setModel:model];
[model release];
// The syntax here is probably off, you should get the idea
UITabBarController *tabs = …;
[tabs setViewControllers:controllerA, controllerB, nil];
[window addSubview:tabs.view];
[window makeKeyAndVisible];
}
私はあなたがappDelegateでこの種の設定をすることはできないと思いませんでした。これは多くの意味があります。私はまだプログラミングの学習段階にいます。ありがとうございました。シングルトンの場合は+1 –