// NSTimeInterval:动画执行时间
[UIView animateWithDuration:2.0 animations:^{
NSLog(@"--------"); // 执行事件
} completion:^(BOOL finished) { // 动画结束后执行
NSLog(@"end");
}];
// 动画开始
[UIView beginAnimations:nil context:nil];
// 设置动画执行时间
[UIView setAnimationDuration:2.0];
/*---------------------------------------------------------*/
/*------------这里面写需要执行动画的事件-----------------------*/
/*---------------------------------------------------------*/
// 设置动画的代理,只有设置了这个属性,才能用下面的start和end方法
[UIView setAnimationDelegate:self];
// 动画开始前执行start方法, [self start]
[UIView setAnimationWillStartSelector:@selector(start)];
// 动画结束后执行end方法, [self end];
[UIView setAnimationDidStopSelector:@selector(end)];
[self.scrollView setContentOffset:CGPointMake(100, 100) animated:YES];