1

iPhone アプリケーションで TabBar を使用し、プログラムで統合しました。その中にいくつかの TabBarItems があり、クリックするたびに、対応する XYZ-View.xib を含む XYZ-ViewController が読み込まれます。

今では、Apple のこの例のように、TabBar と SearchBar を備えた NavBar とセグメント化されたコントロールを備えた画面を使用しています: http://developer.apple.com/iphone/library/samplecode/TableSearch/index.html

しかし、この例では、TabBar がなく、ソースをプロジェクトにコピーすると、XViewController.m viewDidLoad メソッドでロードしたという問題が発生します。

// Add create and configure the navigation controller.
MyAppDelegate *myAppDelegate = [[UIApplication sharedApplication] delegate];

// Add create and configure the navigation controller.
UINavigationController * navigationController = [[UINavigationControlleralloc] initWithRootViewController:self];
myAppDelegate.navController = navigationController;
[navigationController release];
[myAppDelegate.window addSubview:myAppDelegate.navController.view];

その結果、正しいタイトルのツールバーが表示されますが、下部に検索バーも TabBar もありません。

ここで何が問題なのか、誰かにヒントを教えてもらえますか?

4

1 に答える 1

0

私は問題を解決しました:

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:test2ViewController];

NSArray* controllers = [NSArray arrayWithObjects:test1ViewController, navigationController, test3ViewController, nil];
[self.myTabBarController setViewControllers:controllers];
于 2010-01-04T13:23:55.903 に答える