ios - UIScrollView with UICollectionView Child -


i have scrollview, , inside scrollview contains collectionview.

with 1 single swipe, scroll outer scrollview until inner scrollview comes in frame , stop outer scroll , scroll inner (all in 1 swipe). want pass scrolling outer inner on-the-fly.

i able achieve effect must remove finger, , press finger down again , scroll other view:

- (void)scrollviewdidscroll:(uiscrollview *)scrollview { //general scroll info cgfloat scrolloffset = scrollview.contentoffset.y;  //if scrollview reaches top pass touch collection view //however must remove finger , press again in order scroll collectionview if (scrollview == _scrollview && scrolloffset >= 120){     [_scrollview setscrollenabled:no];     [_scrollview setbounces:no];      [_collectionview setscrollenabled:yes];     [_collectionview setbounces:yes];      [self.scrollview setcontentoffset:cgpointmake(0, 120) animated:yes]; }else if (scrollview != _scrollview && scrolloffset < 0){     [_scrollview setscrollenabled:yes];     [_scrollview setbounces:yes];      [_collectionview setscrollenabled:no];     [_collectionview setbounces:no];     [self.collectionview setcontentoffset:cgpointmake(0, 0) animated:yes]; }  } 

i able without having remove finger.

any thoughts?

i able solve problem creating large parent uiscrollview size of screen. inside scrollview had uicollectionview , image inside uiscrollview (for parallax effect).

so looks this:

  • scrollview (size of screen)
    • scrollview
      • imageview
    • collectionview

once reached top of screen collectionview changed content offset on collectionview based on scroll of parent scrollview.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -