ios - UICollectionViewCell embedded in UITableViewCell changes scroll position when re-appears -


i have tableview cells having horizontal collection view. have multiple cells same style. let's tableview cells @ indices 0 & 5 have same style (i using same uitableviewcell subclass in dequeuereusablecellwithidentifier).

  1. user scrolls tableviewcell @ index 5. scrolls horizontal collection view leftwards(let's red-1 , yellow-2 cells hidden, cyan-3 leftmost).
  2. user scrolls tableviewcell @ index 0. although it's different uitableviewcell instance, collection view offset set same cell @ index 5.

enter image description here

in short, when i'm re-using tableview cells, content offset of scroll view inside uitableviewcell being set previous re-used cell.

is there someway can disable behaviour, each cell maintains it's own offset regardless of scroll activity on cell.

you can set cell confirm uiscrollviewdelegate , implement scrollviewdidenddecelerating method save scroll offset , use offset restore original offset when dequeue cell in cellforrowatindexpath of uitableview.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -