MasterRazer
MasterRazer

Reputation: 1377

Repeat scrollView animation

I've set up a animation, for my paging scrollview. Now I want to ask you, if someone knows how to repeat this animation, because my scrollview has a width of 960 and not 320. I tried to find something about this in the web, but at the end I didnt found something useful. Could someone of you, help me with this?

-(void)viewDidAppear:(BOOL)animated {

[UIView animateWithDuration:1.5f animations:^{
    [scrollView setContentOffset:CGPointMake(320, 0)animated:YES];


}];

}

Thanks.

Upvotes: 0

Views: 183

Answers (1)

agoncharov
agoncharov

Reputation: 942

If you want to make a sequence of animations then

for(int i = 0; i < 2; ++i) {
  [UIView animateWithDuration:1.5f animations:^{
      scrollView.contentOffset = CGPointMake(320 + 320*i, 0);    
  }];
}

If you want to make it once then set contentOffset with CGPoint you want (CGPointMake(640, 0))

Of course contentOffset defines offset once and you can use it as you want.

Upvotes: 1

Related Questions