- Code: Select all
var tabController = new NKTabBarController();
tabController.setTabBarForPage("main.html", "Home", "home.png");
tabController.setTabBarForPage("category.html?id=1", "People", "people.png");
tabController.setTabBarForPage("category.html?id=2", "Places", "places.png");
tabController.setTabBarForPage("category.html?id=3", "Things", "things.png");
In the above code, the tab bar would only have two buttons: Home and People, and stop adding buttons afterwords. I suppose because NK views 'category.html' as the same page.
The workaround is to create three pages (people.html, places.html, things.html) and hard-code the identifiers into them. By abstracting your html display for categories into a javascript library, these pages can be very small:
- Code: Select all
<!-- people.html -->
<script type="text/javascript" src="category.js"></script>
<script type="text/javascript">
category.display( 1 ); // 1 is the identifier for 'people'.
</script>
...but it would be nice if the tab controller allows you to pass in parameters.
(Edit...) Or, just use a toolbar instead of a tab controller...
