TabBar 与导航栏/搜索栏和 TableView 结合
我在 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。
谁能给我提示这里出了什么问题吗?
I used a TabBar in my iPhone application and integrated it programmatically.
I have several TabBarItems in it and every click will load a XYZ-ViewController with a corresponding XYZ-View.xib.
Now I use to have a screen with the TabBar and a NavBar with SearchBar and a segmented control like in this example of Apple:
http://developer.apple.com/iphone/library/samplecode/TableSearch/index.html
But in this example, there is not a TabBar and copy the source into my project causes the problem, that I did the loading in XViewController.m viewDidLoad method:
// 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];
The effect is, that there is a toolbar with the correct title, but there is no searchbar and no TabBar at the bottom.
Could anyone give me a hint what's wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了这个问题:
I solved the problem: