Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13000] iOS: ImageView does not the trigger "load" event if touchEnabled is set to false

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2015-02-10T18:22:48.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.0.0
ComponentsiOS
Labelsexalture, ios
ReporterDan Tamas
AssigneePedro Enrique
Created2013-03-07T15:44:36.000+0000
Updated2015-03-10T17:49:04.000+0000

Description

An image won't trigger the load event if touchEnabled is set to false if the image property is set later (think custom caching or remote image)
var win = Ti.UI.createWindow({
	backgroundColor: '#fff'
});

win.open();

var img = Ti.UI.createImageView({
	// image: 'http://thinkmobile.appcelerator.com/Portals/164416/images/appc_stacked.png?' + new Date().valueOf(),
	touchEnabled:false
});
win.add(img);

img.addEventListener('load', function() {
	alert('img loaded');
});


setTimeout(function(){
	img.image = '/sample.jpg'
	// img.image = 'http://thinkmobile.appcelerator.com/Portals/164416/images/appc_stacked.png?' + new Date().valueOf();
},1000);
It can be tested with both the attached image or the remote one. In case the remote image is set in the constructor and the image is cached by Titanium (so no Date() at the end) the second time the app is opened will trigger, but this only because the image is already cached in the device by Ti. The timeout simulates a custom caching where the images are grabbed on the device for offline usage.

Attachments

FileDateSize
sample.jpg2013-03-07T15:44:36.000+000021886

Comments

  1. Meenakshi Pathak 2013-03-08

    Tested the scenario and found it valid.
  2. Sunila 2013-05-01

    Tried with sdk 3.2.0 in Nexus. Regardless of the value for touchEnabled, the load event is fired.
  3. Dan Tamas 2013-05-01

    Why is this closed? The ticket is labeled **ios** and was tested on Nexus?
  4. Tim Poulsen 2013-05-01

    Invalid test. Ticked is labeled iOS yet tested on a Nexus.
  5. Pedro Enrique 2013-11-19

    Pending PR https://github.com/appcelerator/titanium_mobile/pull/4996
  6. Ewan Harris 2015-03-10

    Verified fix on: Mac OSX 10.10.2 Appcelerator Studio, build: 4.0.0.201502171827 Titanium SDK build: 4.0.0.v20150306095010 Titanium CLI, build: 3.5.0-dev Alloy: 1.6.0-alpha Xcode 6.2 iPhone 6 (8.1) Using provided code built to device, when the image loads the load event is triggered. Closing ticket

JSON Source