UITabBar functionality without UITabBarController

感情迁移 提交于 2019-11-29 12:51:18

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.

don't use a tab bar controller, just use a UITabBar inside your controller view and manage the switches between UITableViews yourself, either by:

  • loading up as many table views as you need and stacking them (bringing the one corresponding to the tab bar hit to front)
  • switching a single table view's data 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

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 :(

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!