在子视图的滑动动画(向下,暂停,然后回到原始位置)期间,设备被旋转,因此超级视图被旋转。我想保持subview的宽度与superview相同,所以我需要在滑动动画中调整它的大小。如何在移动动画中途调整视图大小?
这里是滑动动画代码:
[UIView animateWithDuration:0.3 animations:^{
self.frame = finalFrame;
} completion:^(BOOL finished) {
[UIView animateWithDuration:0.3 delay:3 options:0 animations:^{
self.frame = initFrame;
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}];
这是当我检测旋转时调用的方法:
- (void)rotate:(NSNotification *)notif {
// What to do here to adjust the width but also keep the sliding animation going.
}
问题在于“调整大小”不是提前计划的,它是由用户旋转设备触发的。我必须处理滑动动画的中途。我用代码更新了这个问题。 – an0