Warning Older Docs! - You are viewing documentation for a previous released version of RhoMobile Suite.

NativeToolbar API

The NativeToolbar methods let you create and remove toolbars at runtime. Refer to Native Toolbar Control in User Interface for a discussion and examples, and to NativeToolbarTest in Rhodes-System-Api-Samples for sample code.

create

Creates a toolbar.

Rho::NativeToolbar.create(toolbar-elements)
toolbar-elements Name/value array for the tabbar, such as {:label => 'Main page', :action => '/app', :icon => '/public/images/bar/colored_btn.png', :reload => true}

The toolbar-elements parameter is a list of name/value pairs from the following list of toolbar elements.

:label Visible label to display instead of an icon.
:action Path to your rhodes action (i.e. '/app/Account' would load the Account index action). Either :icon or :label must be specified: if both are omitted, Rhodes will not add the button to the toolbar. If both are specified, :icon is drawn and :label is discarded.
:icon Relative path to toolbar item icon in your rhodes app (typically located in /public/images/). iPhone and Android: Icons must be no more than 30x30 pixels and must be in .png format. Windows Mobile: Icons can be any size, but all icons should have same size (default – 48x48).
:colored_icon (optional) true or false; true tells rhodes to use color icon in toolbar on iPhone instead of standard monochrome white icon (prepared from image alpha).
:width (optional) For Windows Mobile, define width in pixels for separator element.

remove

Removes the toolbar.

Rho::NativeToolbar.remove
Back to Top