I「の最も効率的な」は、あなたのコンテキストで何を意味するのかわからないにもかかわらず、私はそれが一般的なタブバーのアプリに来るとき、私は通常、何をすべきかを説明して3を説明しようとするでしょう:
Iサンプルプロジェクトには行かないでください。なぜなら、IBのすべてのものには(私にとっては)魔法がとてもたくさんあるからです(そして、タブバーコントローラとナビゲーションコントローラを組み合わせるのに苦労した経験があります)。
私は単純なプロジェクト、すべてのIBのものを取り除くとアプリデリゲートにそのような何かを得る設定
:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSMutableArray *cons = [[NSMutableArray alloc ]init];
viewController = [[UITabBarController alloc] init];
int i = 0;
UIViewController *firstController = [[SomeViewViewControllerClazz alloc] init];
firstController = [[UITabBarItem alloc]initWithTitle:@"Een" image:nil tag:i];
[cons addObject:firstController];
[firstController release];
i++;
UIViewController *secondController = [[AnotherViewControllerClazz alloc] init];
secondController = [[UITabBarItem alloc]initWithTitle:@"Twej" image:nil tag:i];
[cons addObject:secondController];
[secondController release];
i++;
UIViewController *thirdController = [[WhateverViewControllerClazz alloc] init];
thirdController = [[UITabBarItem alloc]initWithTitle:@"Drej" image:nil tag:i];
[cons addObject:thirdController];
[thirdController release];
i++;
viewController.viewControllers = cons;
[window addSubview:viewController.view];
[window makeKeyAndVisible];
return YES;
}
私はコントローラで、私がやりたいために最大限の自由をしたその方法をタブバーの力で構築されています。
1:最初にコントローラーをロードしても、私は決してメモリーの問題が発生しませんでした。 2:タブバーのアイデアがあなたのアプリに合っている場合は、iOsが提供するようにそれを使用します。
コメントありがとう! :) –