[TIMOB-19036] iOS: Remote ImageViews not loading while scrolling ListView
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2015-10-22T20:55:06.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 5.1.0 |
Components | iOS |
Labels | n/a |
Reporter | David Fox |
Assignee | Hans Knöchel |
Created | 2015-05-23T05:12:17.000+0000 |
Updated | 2015-11-02T19:47:39.000+0000 |
Description
As of this version (4.0.1) on iOS, when scrolling through a ListView that contains ImageViews that use remote images, the images are not loaded until the scrolling of the ListView comes to a complete stop.
Running the same project with 3.5.1 yields the expected result where the ImageViews get loaded as you scroll through the list.
After looking at this further, a lot of times the images don't even load at all unless you play with the scrolling, meaning you scroll past the rows, then go back and stop.
Hello, I have tested this issue with SDK 4.0.0.RC5, with new Appcelerator Studio build: 4.0.1.201505170721. I wasn't able to regenerate the issue. Simple listview with imageview in templates with list section where the image is remote image seems to work fine in iOS. Please provide the test case, so we can regenerate the issue. Thanks.
Hi Amimul, Sorry I haven't gotten around to providing a test case yet. My project is pretty large so abstracting the list in question is a little difficult. I just tested with a continuous build (4.1.0) and the issue is still present. I'll try to get you a test case soon, but in the meantime, I wanted to provide you the template in question. It's pretty complex so I'm thinking maybe the issue is something with what the image is actually in. To re-itterate, the images with bindId "pic" load in a very weird/broken pattern under any SDK above 3.5.1. On 4.0.0 and 4.1.0 the images don't get loaded while scrolling and you need to come to a complete stop, and even then sometimes you need to fidget with the scrolling to get them to load. Template: {noformat} var template = { childTemplates: [ { type: "Ti.UI.View", properties: { width: "100%", height: Ti.UI.SIZE, layout: "horizontal", horizontalWrap: false, top: "8dip", left: "10dip" }, childTemplates: [ { type: "Ti.UI.View", properties: { width: 50, height: 50, }, childTemplates: [ { type: 'Ti.UI.ImageView', bindId: 'pic', properties: { width: 50, height: 50, borderRadius: 25, preventDefaultImage: true } }, { type: 'Ti.UI.View', bindId: 'whiteCircle', properties: { width: 16, height: 16, borderRadius: 8, backgroundColor: "#fff", top: 0, right: 0, visible: false } }, { type: 'Ti.UI.Label', bindId: 'readCheck', properties: { top: 1, left: -1, textAlign: Titanium.UI.TEXT_ALIGNMENT_RIGHT, width: "100%", height: Ti.UI.SIZE, text: "\uE60E", color: "#aaaab8", font: { fontFamily : "icomoon", fontSize: 14 }, visible: false } } ] }, { type: "Ti.UI.View", properties: { top: 0, width: Ti.App.realWidth - 73, height: Ti.UI.SIZE, layout: "vertical", left: 10 }, childTemplates: [ { type: "Ti.UI.Label", bindId: "title", properties: { top: 3, left: 0, bottom: 3, width: Ti.App.realWidth - 83, height: Ti.UI.SIZE, color: "#000", font: { fontFamily: "Helvetica Neue", fontWeight: "bold" } } }, { type: "Ti.UI.View", properties: { width: Ti.UI.FILL, height: Ti.UI.SIZE }, childTemplates: [ { type: "Ti.UI.Label", bindId: "source", properties: { top: 0, left: 0, bottom: 11, color: "#aaaab8", width: Ti.UI.SIZE, height: Ti.UI.SIZE, font: { fontFamily: "Helvetica Neue", fontSize: 12 } } }, { type: "Ti.UI.Label", bindId: "timestamp", properties: { top: 0, right: 12, bottom: 11, color: "#aaaab8", text: "12m", width: Ti.UI.SIZE, height: Ti.UI.SIZE, font: { fontFamily: "Helvetica Neue", fontSize: 12 } } }, ] } ] } ] } ] }; {noformat}
Hello, I have created a sample code to work with listview with Template with remote image, it seems to work fine with SDK 4.0.0.GA. The only issue i saw in iOS is it depends on the internet speed to download the images. so thats why it seem lagging to load the images.
CODE SAMPLE
Thanks.
I am also experiencing this issue. Made 2 screencasts: 3.5.1.GA : https://www.youtube.com/watch?v=W_YgY4jChLY&feature=youtu.be 4.0.0.GA / 4.1.X : https://www.youtube.com/watch?v=zpeiE_q8ZyU&feature=youtu.be
Amimul - thanks for trying to reproduce. I'm thinking this issue gets caused by a more complex listview somehow (see my above listview template) Arjan - thanks for reproducing and taking these videos! These perfectly show the same issue I'm experiencing too. I can take a screen capture too, if that would help, but it would look very similar to Arjan's. Please let us know what you need.
David, I think I found the cause and solution, thanks to some help on the new ti.slack channel. Apparently, the listView has changed in 4.XX: https://github.com/appcelerator/titanium_mobile/commit/1d55715a0f3976ac01e1aef17398e35b165bdd84 A comment on slack: {quote}cdr [3:40 PM] that commit looks wrong, i think it should also resume the ImageLoader on scrollViewDidEndDragging because scrollViewDidEndDecelerating isn't always called cdr [3:40 PM] you can see in your video that it works if you don't "flick" (scroll) the list, if you just drag and never release the images load cdr [3:41 PM] like Ti.UI.ScrollView has dragEnd and scrollEnd{quote} Solution (thanks to ludolphus): - edit ~/Library/Application Support/Titanium/mobilesdk/osx/4.0.0.GA/iphone/Classes/TiUIListView.m - look for scrollViewDidEndDragging - add : [[ImageLoader sharedLoader] resume]; Now the images will load directly again, instead of after releasing the listview. Maybe appcelerator should build in a option/argument for the listView so we can choose which method to use for loading images (directly or after releasing/ending scroll).
Great find!! Thank you for posting this, I really appreciate it. An option would be good. If no option, then it seems the old behavior is much preferable.
[~egomez] What is their rationale for that choice?
Resolving as duplicate of TIMOB-19647, please check the related PR to verify, that the issue is now fixed.
Closing as duplicate.