The NativeTabbar methods let you customize the Rhodes tabbar at runtime. Refer to Native Tabbar Control in User Interface and NativeTabbarTest in Rhodes-System-Api-Samples for examples.
Several of the NativeTabbar methods use a tabs parameter, which is a list of name/value pairs from the following list of tab elements.
:label |
Visible label to display on the tabbar. |
:action |
Path to your rhodes action; i.e. ‘/app/Account’ would load the Account index action. |
:icon |
Relative path to tabbar item icon in your rhodes app; typically located in /public/images/ |
:reload |
(optional) true to reload the tab action, false otherwise (default = false). |
:selected_color |
(optional) Change the selected color of this tab (if you use it on Android, define it for all tabs and define :background_color for TabBar). |
:disabled |
(optional) Disable this tab. |
:web_bkg_color |
(optional) int hex value (for example, 0x7F7F7F). Background color for tab. Use when your application background color is not white for removing blink during switch tabs. |
:use_current_view_for_tab |
(optional) Smooth transfer WebView from current view into this Tab and make this Tab active. Defaults to false. Only one Tab can have this parameter. |
Removes the current tabbar and replaces it with this one.
Rho::NativeTabbar.create(tab-elements, callback)
tab-elements |
Name/value array for the tabbar, such as {:label => 'Main page', :action => '/app', :icon => '/public/images/bar/colored_btn.png', :reload => true}
|
callback |
(optional) Callback method for a change tab event. |
Creates a vertical tabbar on the iPad, a regular tabbar on other platforms.
Rho::NativeTabbar.create_vertical(tabs)
tabs |
Name/value array for the tabbar, such as {:label => 'Main page', :action => '/app', :icon => '/public/images/bar/colored_btn.png', :reload => true}
|
Returns the current tab index.
Rho::NativeTabbar.get_current_tab
Removes the current tabbar. Does nothing if there is no active tabbar.
Rho::NativeTabbar.remove
Set the iPhone badge to tab (only for iOS devices).
Rho::NativeTabbar.set_tab_badge( tab_index, iPhone_badge)
tab_index |
The index for this tab (index numbered from 0 to total tabs - 1). |
iPhone_badge |
String for iPhone badge, such as '12'. |
Switch active tab to second.
Rho::NativeTabbar.switch_tab(tab_index)
tab_index |
Switch to this tab. tabs are numbered from 0 to total of tabs - 1. |