尽管方法已经完全运行,但从未调用此处的动画。
其他方法
if (show) {
[self dropTheHeader];
}
和
-(void)dropTheHeader{
NSLog(@"Show this damn method");
[UIView animateWithDuration:2
delay:0
options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.searchHeader.frame = CGRectOffset(self.searchHeader.frame, 0, -44);
}completion:^(BOOL finished){
self.searchHeader.hidden = YES;
}];
}
它很奇怪。日志被调用和一切,只是没有动画。检查一下self.searchHeader是否为Nil,没有骰子。有人有什么想法吗?
修改
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}}
答案 0 :(得分:1)
试试这个,让我知道输出是什么:
[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");
}
}];