Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11231] iOS: Toolbar button clicks not working in iphone simulator

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2012-11-05T20:07:51.000+0000
Affected Version/sRelease 2.1.2, Release 2.1.3, Release 3.0.0
Fix Version/s2012 Sprint 23 API, 2012 Sprint 23
ComponentsiOS
Labelsapi
ReporterDavid Price
AssigneeIngo Muschenetz
Created2012-10-02T09:42:04.000+0000
Updated2017-06-07T21:29:37.000+0000

Description

Appologies if this is wrong, I have asked this as a question and have not got an answer, so I guess it's a bug ? The attached code works on ipad 5.1 simulator but NOT on iphone 5.1 simulator: i.e. debug messages on ipad simulator but NOT iphone simulator
var mainWindow;
var topToolbar;
var leftButton, rightButton;

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

mainWindow = Titanium.UI.createWindow({
	title : 'iOS Toolbar Test',
	backgroundColor : 'black',
	navBarHidden : true,
	modal : false,
	zIndex : 1,
	exitOnClose : true
});

// Create buttons for interaction
leftButton = Titanium.UI.createButton({
	style : Ti.UI.iPhone.SystemButtonStyle.DONE,
	title : 'Left'
});
leftButton.addEventListener('click', function(e) {
	Ti.API.debug('leftButtonClickListener( ' + JSON.stringify(e) + ' )');
});
rightButton = Titanium.UI.createButton({
	style : Ti.UI.iPhone.SystemButtonStyle.DONE,
	title : 'Right'
});
rightButton.addEventListener('click', function(e) {
	Ti.API.debug('rightButtonClickListener( ' + JSON.stringify(e) + ' )');
});

titleLabel = Ti.UI.createLabel({
	text : 'A Test Toolbar',
	font : {
		fontSize : 20,
		fontWeight : 'bold'
	},
	color : '#ffffff',
	textAlign : 'center',
	width : 400,
});
var flexSpace = Ti.UI.createButton({
	systemButton : Ti.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});

topToolbar = Titanium.UI.iOS.createToolbar({
	items : [leftButton, flexSpace, titleLabel, flexSpace, rightButton],
	top : 0,
	borderTop : false,
	borderBottom : true,
	translucent : false,
	backgroundColor : 'black',
	barColor : '#000',
	zIndex : 50
});

mainWindow.add(topToolbar);

mainWindow.open();

Attachments

FileDateSize
app.js2012-10-02T09:42:04.000+00002472

Comments

  1. Daniel Sefton 2012-10-02

    Tested and confirmed on iOS 5.1, TiSDK 2.1.2 GA, 2.1.3 RC2, 3.0.0. Cleaned up code a little. In fact, it doesn't work on iPad for me either.
  2. Vishal Duggal 2012-11-05

    Remove the width property of the titleLabel and things should work fine. Basically since the width is set to 400, the titleLabel bounds overlap the two button bounds which makes it the lowermost view to receive touch events.
  3. Lee Morris 2017-06-07

    Closing ticket, please open a new ticket if any more problems persist.

JSON Source