Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

[ASRangeController] Clarifications on how working ranges are expected to function (iOS 7) #840

Closed
haashem opened this issue Nov 12, 2015 · 8 comments

Comments

@haashem
Copy link

haashem commented Nov 12, 2015

as it supposed to be pre layouting cells in ASCollectionView works well in iOS 8 and 9 and cells gets layout in advance. but today I test it on my iPhone 4 with iOS 7. cells layout method doesn't called, until I scroll to that cell!
any idea?

@appleguy
Copy link
Contributor

@hashemp206 hmm, that definitely shouldn't be the case. Thanks for reporting it. Can you give more information on your setup? What are the values for rangeTuningParameters? What do you have onscreen; just a vertical collection view, or does it also contain horizontally scrolling elements?

Note this is the expected behavior:

  • layoutSpecThatFits should be called well in advance of the working range; this is actually called "as quickly as possible" for all nodes in the data source. If you add items, then it should be called shortly after that - EVEN IF the user doesn't scroll. This is not controlled by ranges.
  • fetchData / display - these are called by the ranges (Network and Render ranges). You can also implement -clearFetchedData or -clearContents if you want to see when things are falling out of the ranges.
  • layout (the actual layout "application" method) - this is called only when cells come onscreen. It should be extremely fast, since the measurement pass (-layoutSpecThatFits:) has already happened. It should be called only when cells are coming onscreen for all iOS versions and devices.

@appleguy appleguy changed the title ASCollectionView setTuningParameters doesn't work in iOS 7 [ASRangeController] Clarifications on how working ranges are expected to function (iOS 7) Nov 12, 2015
@haashem
Copy link
Author

haashem commented Nov 12, 2015

here is the sample app:
HorizontalColelctionView
run it on iPhone 4 and another device with iOS 8 and above.
see the generated logs when app launched. you seen on iOS 7 devices layout method for next cells won't called in advance!

scroll smoothly to next item on iPhone 4 you see next cells backgroundImageNode had not layouted! and immediately you see image loaded with a popcorn effect. but on later iOS version pop corn effect won't visible!

@appleguy
Copy link
Contributor

Thanks a lot for the test app! Going to check it out now.

@appleguy
Copy link
Contributor

@hashemp206 could you be more precise about the "layout" methods you're talking about? Let me know kinda step-by-step exactly what you're comparing. Are you looking at when -layout is called? or is it -layoutSpecThatFits? or something else?

@appleguy
Copy link
Contributor

@hashemp206 I got your app running on an iPhone 4 with iOS 7. I don't see any obvious issues...if you swipe fast enough, you can get ahead of the image decoding, and briefly see the blue background. However, if you scroll slowly, I don't see any of these blue reveals.

This doesn't appear to be any issue with layout not being performed, simply rendering catching up. You can use .backgroundColor or other features like .placeholderImage to customize the appearance of the image area before the decoding is finished.

Please let me know ASAP if you have any other input on the symptom you're seeing. A video would be a good option!

@appleguy
Copy link
Contributor

@hashemp206 oh man, I just found that you had closed this task...I wonder why?!

#769

That is definitely still an issue, and is a known issue. I can reproduce THAT problem if I scroll left and right between "one" and "five" - but it works fine if I scroll incrementally through 1, 2, 3 ... 5, 1, 2 without any flashes.

Since the issue with a cyclic view is already known, can you provide more clear descriptions of what the problem is that doesn't involve the cyclic part of the view? If we disabled cyclic scrolling, that would be the best way to test it.

@haashem
Copy link
Author

haashem commented Nov 14, 2015

@appleguy thanks for feedback,
in my mind layout method load all the view and put subviews to the memory.similar to viewDidLoad in UIViewController. using rangeController cause the defined range of view to be loaded so when you scroll there is no need to initialize and loading them to the memory! (Am I right?)

if Im right in iOS 7 subsequent cells won't load immediately but on iOS 8 and above works well. see the generated logs.

screen shot 2015-11-14 at 4 44 44 pm

screen shot 2015-11-14 at 4 45 22 pm

in this video after application launched and after 6 seconds later I scroll to next cell! as you see cell is not loaded!
https://dl.dropboxusercontent.com/u/45698608/rangeController%20iOS%207.mov

I'm using ASyncDisplayKit a lot in my app and I really need circular scrolling in some of my custom controls! the only hack I found to prevent flashing when backwarding is preloading all cells in advanced!

@garrettmoon
Copy link
Contributor

This issue was moved to TextureGroup/Texture#110

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants