4
votes

I am able to achieve horizontal scrolling with dynamic addition of images on them, with infinite scrolling and lazy loading of images as well.

Actually, I am kind of stuck, about how to proceed with vertical scrolling of image in regards to horizontal image being displayed.

For Eg: I pull down some images from server, those are random pics, and those pics are associated to some albums of a user on my server.

So, when user scrolls left to right (horizontal) then scrollview should display all the downloaded bunch of images, but when user scroll up/down then scrollview should display other images associated to album of current image (from horizontal mode). Say I downloaded image 1,2,3 and 4. and When I scroll up/down then say for index 2, it should display 2.1, 2.2 etc which is nothing but linked to the album.

I have the json with me for both vertical and horizontal screens. however, I am not sure how to modify my current flow (infinite scrolling+lazy load) with albums kinda view.

Thanks for the help.

2
would you please explain with codeWarewolf

2 Answers

0
votes

Create vertical ScrollViews inside your horizontal ScrollView. Each vertical ScrollView represents an album. Fill all images in that album to this vertical ScrollView. Set direction lock to yes for all ScrollViews. The whole structure should like below.

      -------------      -------------
      |           |      |           |
      |  -------  |      |  -------  |  > Vertical ScrollViews
      |  |     |  |      |  |     |  |     with images inside
      |  |     |  |      |  |     |  |
      |  |     |  |      |  |     |  |
      |  |     |  |      |  |     |  |
      |  -------  |      |  -------  | 
      |           |      |           |
-------------------------------------------------------------------------------
|     |           |      |           |                                        |
|     |  -------  |      |  -------  |                                        |
|     |  |     |  |      |  |     |  |                                        |
|     |  |     |  |      |  |     |  |                                        |
|     |  |     |  |      |  |     |  |            Horizontal ScrollView       |
|     |  |     |  |      |  |     |  |            with vertical Scrolls       |
|     |  -------  |      |  -------  |                                        |
|     |           |      |           |                                        |
|     -------------      -------------                                        |
-------------------------------------------------------------------------------
-1
votes

For solve this issue you have to create touch method for horizontal scroll and according to touch update the vertical scroll Scrollview data.If you need then I also post some tips of code.

 if(CGRectContainsPoint([imgView frame], [touch locationInView:scrollView]))
    {
        [self ShowDetailView:imgView];
        break;
    }
}

}

-(void)ShowDetailView:(UIImageView *)imgView

{

 selectOther_ImageView.image = imgView.image;       
}