1

I need in my project to make the scroll an image continuously, ie from the bottom of the image once scrolled by continuing to scroll to the top should start from the base and so on, in a sort of loop, how can I do to do this?

Thanks

AleMal
  • 1,977
  • 6
  • 24
  • 49
  • I think you ask for this, http://stackoverflow.com/questions/3763978/360-panorama-librarys-for-ios. – Vignesh Feb 16 '12 at 07:06

2 Answers2

1

I gives the two reference link for the automatically scroll the scroll view where the you can grap the source code also and implement into your project it's amazing funcationality

1) Automatically scroll the scroll view

2) As par your requirement created post of like wise gallery.

May this post is useful for you.

Happy codeing Thanks and Regards,

@Samuel

Nimit Parekh
  • 16,776
  • 8
  • 50
  • 72
1

In this example i am taking total 5 images

- (void)viewDidLoad {
        [super viewDidLoad];

        // add the last image (image4) into the first position
        [self addImageWithName:@"image4.jpg" atPosition:0];

        // add all of the images to the scroll view
        for (int i = 1; i < 5; i++) {
            [self addImageWithName:[NSString stringWithFormat:@"image%i.jpg",i] atPosition:i];
        }

        // add the first image (image1) into the last position
        [self addImageWithName:@"image1.jpg" atPosition:5];

        scrollView.contentSize = CGSizeMake(320, 2496);    
        [scrollView scrollRectToVisible:CGRectMake(0,416,320,416) animated:NO]; 
    }

    - (void)addImageWithName:(NSString*)imageString atPosition:(int)position {
        // add image to scroll view
        UIImage *image = [UIImage imageNamed:imageString];
        UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
        imageView.frame = CGRectMake(0,position*416,320, 416);
        [scrollView addSubview:imageView];
        [imageView release];
    }

implement delegate method

- (void)scrollViewDidEndDecelerating:(UIScrollView *)sender {    
    NSLog(@"%f",scrollView.contentOffset.y);
    // The key is repositioning without animation      
    if (scrollView.contentOffset.y == 0) {         
        // user is scrolling to the left from image 1 to image 4         
        // reposition offset to show image 4 that is on the right in the scroll view         
        [scrollView scrollRectToVisible:CGRectMake(0,1664,320,416) animated:NO];     
    }    
    else if (scrollView.contentOffset.y == 2080) {         
        // user is scrolling to the right from image 4 to image 1        
        // reposition offset to show image 1 that is on the left in the scroll view         
        [scrollView scrollRectToVisible:CGRectMake(0,416,320,416) animated:NO];         
    } 
}
Mudit Bajpai
  • 3,010
  • 19
  • 34