TabBar结合导航栏/搜索栏和TableView
问题描述:
我在我的iPhone应用程序中使用了一个TabBar,并以编程方式将其集成。 我有几个TabBarItems在里面,每次点击都会加载一个XYZ-ViewController和一个对应的XYZ-View.xib。TabBar结合导航栏/搜索栏和TableView
现在我用有一个与的TabBar一个屏幕和搜索栏一的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在底部。
任何人都可以给我一个提示这里有什么问题吗?
答
我解决了这个问题:
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:test2ViewController];
NSArray* controllers = [NSArray arrayWithObjects:test1ViewController, navigationController, test3ViewController, nil];
[self.myTabBarController setViewControllers:controllers];
搜索栏是存在的。我必须重新连接插座,然后搜索一切正常。 但主要问题仍然存在:TabBar消失在TableView后面。 TableView似乎覆盖它。点击一个tableviewcell,它会翻到下一个屏幕,右边的工具栏和一个“后退按钮”,这里我看到TabBar,但它不可点击。 那么,这里有什么问题?我必须做什么? 非常感谢! – Tim 2009-12-23 15:37:40