おはよう。私は自分のアプリにナビゲーションコントローラを備えた新しいタブを追加しようとしています。私は新しいタブ付きアプリ(Xcodeの4.2)を作成し、appdelegateにこのタブ付きアプリケーションにナビコントローラを追加
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
// Override point for customization after application launch.
UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil] autorelease];
NavController *navController = [[[NavController alloc] initWithNibName:@"NavController" bundle:nil] autorelease]; //my controller
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:viewController1, viewController2, navController, nil];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
NavController.hはここ
@interface NavController : UINavigationController
@end
プロジェクト
の構造ファイルを書いて、私はプロジェクトにそれを実行すると空のタブを表示する xibファイルでlableとボタンを追加する 私は何かを忘れているかもしれませんか?
は、デリゲートUINavigationController * localNavigationControllerでこれを追加しようとしました。 NavController * navController = [[[NavController alloc]] initWithNibName:@ "NavController"バンドル:nil] autorelease]; localNavigationController = [[UINavigationController alloc] initWithRootViewController:navController];しかし、initWithRootControllerMethodでクラッシュしました – nabiullinas