0

I am using

[scrollView_Mag setContentOffset:CGPointMake(320 * currentImageView, 0) animated:No];

so that I can scroll to a particular View(as required). In code "currentImageView" is the number of the view, I want to scroll.It is working perfectly. Only problem is, That for example i am 320*10 point and I want to setContent offset to 320*2, It scrolls from point 320*10 to 320*2, thus showing all other stuff. Which I dont want. I want It to scroll Immidately and without showing any other Content

Jasmeet
  • 1,522
  • 2
  • 22
  • 41

1 Answers1

0
[scrollView_Mag setHidden:YES];
[scrollView_Mag setContentOffset:CGPointMake(320 * currentImageView, 0) animated:NO];
[scrollView_Mag setHidden:NO];

When you move the content offset:

 //Define this BOOL in header
 isManuallyScrolling = YES; 
 [scrollView_Mag setHidden:YES];
 [scrollView_Mag setContentOffset:CGPointMake(320 * currentImageView, 0) animated:NO];


//Use the scrollView delegate method to see when it stopped scrolling
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {

    //If we manually scrolled, unhide the scrollView
    if (isManuallyScrolling) {
        [scrollView_Mag setHidden:NO];
        isManuallyScrolling = NO;
    }
}
random
  • 8,568
  • 12
  • 50
  • 85
  • it too, didn't work. I tried it. It should have worked, Like I need. But It didn't. :( – Jasmeet Jan 22 '14 at 18:49
  • thats a very good trick. I tried, it after reading your answer but the problem is It makes the scrolView permannetly hidden. i.e "- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView" is never called – Jasmeet Jan 22 '14 at 19:12
  • @PiyushMishra Sir can you help me with this problem? I will be very thankful to you – Jasmeet Jan 22 '14 at 19:23
  • Any other hint, suggestion . will be greatful – Jasmeet Jan 22 '14 at 19:29
  • @Jeev try the above implementation but set animated to `YES`. The delegate method may not fire since it isn't technically every accelerating or decelerating. – random Jan 22 '14 at 19:48