我有一种方法来动画和重置下面给出的视图。
-(void)animateToFocus:(BOOL)animate index:(NSInteger)index {
if (animate) {
[UIView beginAnimations:@"Scroll" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationsEnabled:YES];
self.view.frame = CGRectMake(0, -50*index, self.view.bounds.size.width, self.view.bounds.size.height);
[UIView commitAnimations];
} else {
[UIView beginAnimations:@"Scroll" context:nil];
[UIView setAnimationDuration:0.5];
[UIView setAnimationDelegate:self];
[UIView setAnimationsEnabled:YES];
self.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
[UIView commitAnimations];
}
}
当我在此方法中传递 YES 和标签时,它将动画到顶部,当我传递 NO 时,它将重置视图。它在 IOS6 中完美运行。当我更新到 IOS 7 时,重置完成如下:
它不会完整地设置动画,并且底部会出现黑色空间。你能帮我解决这个问题吗?