[TIMOB-7540] iOS: Titanium.UI.Label: click event fails to fire
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-02-14T23:29:02.000+0000 |
Affected Version/s | Release 1.8.0.1, Release 1.8.1 |
Fix Version/s | Sprint 2012-03, Release 2.0.0, Release 1.8.2 |
Components | iOS |
Labels | module_label, qe-testadded, regression |
Reporter | Dustin Hyde |
Assignee | Max Stepanov |
Created | 2012-02-03T11:03:57.000+0000 |
Updated | 2012-03-13T13:23:41.000+0000 |
Description
iOS: Titanium.UI.Label: click event fails to fire. Regression. Works in 1.7.5. Works on Android.
Steps to Reproduce:
1. Run code.
var win = Ti.UI.createWindow({
backgroundColor:'white',
layout:'vertical'
});
var label = Ti.UI.createLabel({
text:'Click Label',
color:'black',
height:'auto',
width:'auto'
});
win.add(label);
win.open();
label.addEventListener('click',function(){
Ti.API.info('Label Clicked');
label.text = 'Label Clicked';
});
2. Click label.
Expected Result:
Label text should change to 'Label Clicked', and
'Label Clicked' should print to the console.
Actual Result:
Nothing happens.
Note: Will investigate more hardware in future.
Take a look at TiUIView.m, namely that now that I added gesture recognizers, I removed the toggling of userInteractionEnabled, since default is YES, and it turns out gesture recognizers don't care about view enablement (Test to see if "singletap" still triggers--that uses recognizers, click doesn't). It might be that the default of userInteractionEnabled is NO on UILabel, which may suppress the touch events that lead to click messages. If you jury-rig userInteractionEnabled to YES on TIUIView, and the regression magically goes away, then you know what to do.
Thanks for the tip, Blain. However the issue is related to when the click listener is attached: before or after window open.
Closing bug. Verified fix on: SDK build: 1.9.0.v20120207171634 Titanium Studio, build: 1.0.8.201201262211 xcode: 4.2 Devices: iphone 4S Sprint (5.0.1)