0

我有一种方法来动画和重置下面给出的视图。

-(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 时,重置完成如下:在此处输入图像描述

它不会完整地设置动画,并且底部会出现黑色空间。你能帮我解决这个问题吗?

4

1 回答 1

0

我猜那是一个 UITableView 里面?

如果是这样,您不应该为您应该使用的帧设置动画:

– scrollToRowAtIndexPath:atScrollPosition:animated:

或者:

– scrollToNearestSelectedRowAtScrollPosition:animated:
于 2013-10-10T07:46:31.213 回答