Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change the speed of setContentOffset:animated:?

Is there a way to change the speed of the animation when scrolling a UITableView using setContentOffset:animated:? I want to scroll it to the top, but slowly. When I try the following, it causes the bottom few cells to disappear before the animation starts (specifically, the ones that won't be visible when the scroll is done):

[UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:3.0]; [self.tableView setContentOffset:CGPointMake(0, 0)]; [UIView commitAnimations]; 

Any other way around this problem? There is a private method _setContentOffsetAnimationDuration that works, but I don't want to be rejected from the app store.

like image 710
Jordan Kay Avatar asked Dec 10 '10 01:12

Jordan Kay


1 Answers

[UIView animateWithDuration:2.0 animations:^{     scrollView.contentOffset = CGPointMake(x, y); }]; 

It works.

like image 113
TK189 Avatar answered Sep 17 '22 17:09

TK189