[AC-2163] MaskedImage does not work in ListView template on device
GitHub Issue | n/a |
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-10-20T14:51:18.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | n/a |
Reporter | Michael Descher |
Assignee | Eric Wieber |
Created | 2013-10-17T18:30:47.000+0000 |
Updated | 2016-03-08T07:41:08.000+0000 |
Description
When using a MaskedImage in a ListView template all works fine in the simulator. On the actual device however the app crashes with a class not found error. I attached a simple test case which shows the problem (you have to add a test.png image to to project). It works fine in the simulator but crashes on the iPhone 5S with iOS 7.0.2. Also attached the logs from the device.
Attachments
File | Date | Size |
app.js | 2013-10-17T18:30:47.000+0000 | 516 |
crashlog.txt | 2013-10-17T18:30:47.000+0000 | 36365 |
log.txt | 2013-10-17T18:30:47.000+0000 | 3727 |
Seems to be some class loading issue. I added the call "Titanium.UI.createMaskedImage()" as the very first line in my app and that made it work.
Hello Michael Descher, Is it working well in your device? Thanks
Yes, when I add an explicit createMaskedImage call in the app before the ListView uses the MaskedImage in the template it works fine on my iPhone 5s with iOS 7.0.2.
I added added the call "Titanium.UI.createMaskedImage()" as the very first line in my app and that made it work. But it is a bug, isn't it? Please fix this bug. I was struggling to find the reason. I hope that there is no person to make it work.
Hi Jong, This is not a bug but is as designed. Using createMaskedImage() is the correct way to use masked images. When apps are run on the simulator, many more libraries and resources are loaded than if the app is run on a device (which only loads the resources you specify). These resources allow for the masked images to work as called in the above sample, however using a string for masked images in a template is still not supported with devices. So, to have your apps work correctly on simulators and devices, use createMaskedImage(). I hope that helps make things a little clearer. Please let me know if you still have questions.