开发者

UITabBar functionality without UITabBarController

I have this problem, I've got a navigation-based application, and on the one of the detail view i need to have UITa开发者_如何学PythonbBar, 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.


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜