没有 UITabBarController 的 UITabBar 功能
我有这个问题,我有一个基于导航的应用程序,并且在详细视图之一上我需要有 UITabBar,它将显示一些 UITableViews。由于苹果文档说“你永远不应该将标签栏控制器添加到导航控制器”,这会造成很大的问题,我找到了这个示例: 链接文本,它正在工作,但是在选择其中一个表视图后,UITabBar 消失了。
I have this problem, I've got a navigation-based application, and on the one of the detail view i need to have UITabBar, which will display some UITableViews. Since apple documentation says "you should never add a tab bar controller to a navigation controller" it make quite a problem, i've found this sample: link text, it's working, but after picking one of the table view, the UITabBar disappears.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不要使用选项卡栏控制器,只需在控制器视图中使用 UITabBar 并自己管理 UITableView 之间的切换,方法是:
需要并堆叠它们(带来
与标签栏点击对应的一个
到前面)
来源和委托给少数人
辅助对象 - 您的每个选项卡一个
酒吧。当用户单击选项卡时,重置单个表视图的数据源,然后指示其重新加载数据
don't use a tab bar controller, just use a UITabBar inside your controller view and manage the switches between UITableViews yourself, either by:
need and stacking them (bringing the
one corresponding to the tab bar hit
to front)
source and delegate among a few
helper objects - one per tab in your
bar. When the user clicks a tab, reset the single table view's data source then instruct it to reloadData
现在您没有使用 TabBarController 来显示表格视图(如链接中所述),您是否确保点击选项卡时添加的表格视图或任何其他视图的大小正确?
您正在添加子视图或将其置于顶部,因此表视图可能会覆盖您的选项卡栏。
Now that you are not using a TabBarController for showing the tableviews (as mentioned in the link), have you made sure that the table views or any other views you are adding when a tab is tapped are correct size?
You are adding a subview or bringing it to top so the table view is probably covering your tab bar.
当他们从表视图中选择一个项目时,您是否将新的视图控制器推送到导航控制器上?如果是这样,您将把标签栏抛在后面!
如果没有大量的黑客攻击,您通常无法完成您想要做的事情。相反,您需要做的是在选择表格单元格时自行添加新视图,以便您添加的新视图不会与底部的选项卡栏重叠。尽管这可能会破坏导航控制器。
尽管我的建议是重新考虑应用程序用户界面的这一部分,这样您就不会关心选项卡栏是否消失。对不起 :(
When they are choosing an item from your table view are you pushing a new view controller onto your navigation controller? If so, you will leave the tab bar behind!
Without some hefty hacking, you generally can't do what you're trying to do. What you'd have to do instead is to deal with adding new views yourself when a table cell is selected so the new views you add don't overlap the tab bar at the bottom. Though this will probably break the navigation controller.
Though my advice is to rethink that part of the app's ui so you don't care that the tab bar vanishes. Sorry :(