我在我的 iPhone 应用程序中使用了 TabBar 并以编程方式集成它。我有几个 TabBarItems,每次点击都会加载一个带有相应 XYZ-View.xib 的 XYZ-ViewController。
现在我使用了一个带有 TabBar 的屏幕和一个带有 SearchBar 的 NavBar 和一个分段控件,就像在这个 Apple 示例中一样: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。
谁能给我一个提示这里有什么问题?