I have to implement a tab bar based application. There are two requirements
- The tab bar item would be more than 10 and they should scroll not show in next page. I have got a reference of this and working on it. But i am not getting any starting point for this second one.
- It should show(tabbar) at the top of the screen not bottom mostly like implemented in app as shown in the link http://appworld.blackberry.com/webstore/content/screenshots/21999/?lang=en.
So if any one has any idea or code then please let me know and help me.
Clearly you cannot use UIKit’s UITabBarController.
You need to define your own custom solution.
Possible solution:
e.g. Button1 –> View1; Button2 –> View2
In point [3] why it is better to use a view controller instead of a view? because using a view controller allows you to separate logic functionality for each of the tab bar functions, instead of cramming everything in the same view controller.
Basically you have one “main” view controller, which instantiates the scroll view (with buttons) and contains another subview (initially empty) called “container” that will take the remaining part of the screen.
Now when you click on each button, you will alloc-init its corresponding view controller (let’s call it “child1”), you will loads its view (“child1.view”) and then you will add it as subview of the “container”:
(don’t forget to remove the existing subview in the container before).
Important note: the only view controller that will respond to events such as interface rotation will be only “main” and not “child”. So interface orientation management must be still done by “main” and all orientation change events have to be sent by your code to the child container.
The good of this approach is that the functionality of the single child can be fully implemented in its view controller and “main” will work just as a container and tab manager, with no core logic functionality.
It makes sense to move this logic to a higher level view controller for high reusability, but it would be quite more complex.