Iphone If()处于播放状态时未调用块UIAnimation

Iphone If()处于播放状态时未调用块UIAnimation,iphone,ios,objective-c,Iphone,Ios,Objective C,这里的动画永远不会被调用,尽管该方法得到了完整的运行 其他方法 if (show) { [self dropTheHeader]; } 及 真奇怪。日志会被调用,所有的一切,只是没有动画。检查self.searchHeader是否为零,无骰子。有人有什么想法吗 编辑 试试这个,让我知道输出是什么: [UIView animateWithDuration:2 delay:0 options:UIView

这里的动画永远不会被调用,尽管该方法得到了完整的运行

其他方法

 if (show) {
    [self dropTheHeader];
}

真奇怪。日志会被调用,所有的一切,只是没有动画。检查self.searchHeader是否为零,无骰子。有人有什么想法吗

编辑


试试这个,让我知道输出是什么:

[UIView animateWithDuration:2
                      delay:0
                    options:UIViewAnimationOptionCurveEaseOut
                 animations:^{
                     NSLog(@"searchHeader hidden: %@", self.searchHeader.hidden ? "yes" : "no");
                     NSLog(@"the current frame is: %@", NSStringFromCGRect(self.searchHeader.frame));
                     self.searchHeader.frame = CGRectOffset(self.searchHeader.frame, 0, -44);
                     NSLog(@"the new frame is: %@", NSStringFromCGRect(self.searchHeader.frame));
                 }completion:^(BOOL finished){

                     if (finished) {
                         NSLog(@"the completed frame is: %@", NSStringFromCGRect(self.searchHeader.frame));
                         self.searchHeader.hidden = YES;
                     } else {
                         NSLog(@"completion handler called before finishing animation");
                     }

                 }];

您能确认searchHeader更改的帧吗?尝试分配一些固定的cgrect以查看动画是否发生。另外,在完成块中,在隐藏视图之前检查完成的布尔值。好吧,伙计,将其添加到问题中以便您可以更容易地看到它。它太奇怪了,似乎肯定与if()语句有关,因为如果我删除它,它运行得很好。但是我找不到其他有类似问题的人。你在IB中打开了自动布局吗?或者IB中设置的任何约束?您是否将其移动到其他可能覆盖异步运行的动画的位置?这不可能只是if语句。
2013-09-26 11:34:47.362 Pict[3077:907] searchHeader hidden: no
2013-09-26 11:34:47.364 Pict[3077:907] the current frame is: {{0, 0}, {320, 88}}
2013-09-26 11:34:47.366 Pict[3077:907] the new frame is: {{0, -44}, {320, 88}}
2013-09-26 11:34:49.411 Pict[3077:907] the completed frame is: {{0, 0}, {320, 88}}
[UIView animateWithDuration:2
                      delay:0
                    options:UIViewAnimationOptionCurveEaseOut
                 animations:^{
                     NSLog(@"searchHeader hidden: %@", self.searchHeader.hidden ? "yes" : "no");
                     NSLog(@"the current frame is: %@", NSStringFromCGRect(self.searchHeader.frame));
                     self.searchHeader.frame = CGRectOffset(self.searchHeader.frame, 0, -44);
                     NSLog(@"the new frame is: %@", NSStringFromCGRect(self.searchHeader.frame));
                 }completion:^(BOOL finished){

                     if (finished) {
                         NSLog(@"the completed frame is: %@", NSStringFromCGRect(self.searchHeader.frame));
                         self.searchHeader.hidden = YES;
                     } else {
                         NSLog(@"completion handler called before finishing animation");
                     }

                 }];