繁体   English   中英

UIView动画在IOS 7中无法正常工作

[英]UIView Animation not working properly in IOS 7

我有一种方法可以设置动画并重置下面给出的视图。

-(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和此方法中的标记时,它将动画到顶部,而当我通过否时,它将重置视图。 它在IOS6中完美运行。当我更新到IOS 7,重置完成为: 在此处输入图片说明

它将不会为completeley设置动画,并且底部会出现一个空白区域。 你能帮我解决这个问题吗?

我猜里面是UITableView吗?

如果是这样,则不应使用它的动画框架:

– scrollToRowAtIndexPath:atScrollPosition:animated:

要么:

– scrollToNearestSelectedRowAtScrollPosition:animated:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM