在子视图的滑动动画(向下,暂停,然后向上回到原始位置)期间,设备旋转,因此超级视图旋转。我想保持子视图的宽度与父视图相同,所以我需要在其滑动动画期间调整它的大小。
这是滑动动画代码:
[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.
}