Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5880] iOS - Expose "error" event in remote images

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-11-01T12:14:33.000+0000
Affected Version/sn/a
Fix Version/sSprint 2011-43, Release 1.8.0
ComponentsiOS
Labelsmodule_imageview, qe-testadded
ReporterPedro Enrique
AssigneeReggie Seagraves
Created2011-10-26T13:08:00.000+0000
Updated2014-07-01T09:48:43.000+0000

Description

Feature Request:

Expose "error" event in imageViews

Description

If a remote image fails to render, the console outputs the following:
[ERROR] Failed to load image:'http://someimage.png', error: .... 
We need a way to catch that error in the Javascript so that we can act accordingly, for example, show an "error_image.png".

Example:

var img = Ti.UI.createImageView({
	image:'http://someurl.com/someimage.png'
});
win.add(img);
img.addEventListener('error', function(){
	img.image = 'error_image.png';
});

Comments

  1. Olga Romero 2012-08-17

    Verified fix with: Titanium Studio, build: 2.1.1.201207271312 Titanium SDK: 2.2.0.v20120816212512 Devices: iPhone 4s 5.0.1 iPad1 ios5 5.1.1 Simulator 5.1 Mac osx 10.8 Mountain Lion

JSON Source