[TIMOB-6975] iOS: Allow toolbars in nav bar (currently always width 0)
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-07-16T17:44:07.000+0000 |
Affected Version/s | Release 1.8.0.1 |
Fix Version/s | n/a |
Components | iOS |
Labels | api, tbs-1.9.0, training |
Reporter | Stephen Tramer |
Assignee | Ingo Muschenetz |
Created | 2012-01-04T11:04:10.000+0000 |
Updated | 2017-03-16T21:08:07.000+0000 |
Description
We need to be able to support adding a toolbar as the left/right nav buttons in order to support multiple system-styled buttons in the nav bar:
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
// create tab group
var tabGroup = Titanium.UI.createTabGroup();
//
// create base UI tab and root window
//
var b1 = Ti.UI.createButton({
style:Ti.UI.iPhone.SystemButtonStyle.PLAIN,
systemButton:Ti.UI.iPhone.SystemButton.DONE
});
var b2 = Ti.UI.createButton({
style:Ti.UI.iPhone.SystemButtonStyle.PLAIN,
systemButton:Ti.UI.iPhone.SystemButton.EDIT
});
var toolbar = Ti.UI.iOS.createToolbar({
items:[b1, b2],
width:'auto'
});
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff',
leftNavButton:toolbar
});
var label1 = Titanium.UI.createLabel({
color:'#999',
text:'I am Window 1',
font:{fontSize:20,fontFamily:'Helvetica Neue'},
textAlign:'center',
width:'auto'
});
label1.addEventListener('click', function(e) {
Ti.API.info('Yup!')
})
win1.add(label1);
//
// add tabs
//
var tab1 = Titanium.UI.createTab({
icon:'KS_nav_views.png',
title:'Tab 1',
window:win1
});
tabGroup.addTab(tab1);
// open tab group
tabGroup.open();
See TIMOB-1164 for a discussion about why this feature is necessary.
*NOTE:* This ticket may be invalid based on the existence/functionality of Ti.UI.Window.toolbar
. Need to check the source/tests to see what that property actually does and whether or not it's comprable.
Would be better if Titanium supported adding an array of buttons to the (left|right)NavBar. Then you could also take advantage of the [native methods](http://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationItem_Class/Reference/UINavigationItem.html) for this in iOS 5, with an iOS 4 fallback.
As stated on TIMOB-1164, we will not be adding iOS 5-specific features until minimum version configuration is allowed.
Fixed by TIMOB-16094 Exposed setting multiple buttons on navBar via leftNavButtons and rightNavButtons property.
Closing ticket as fixed.