在子视图的滑动动画(向下,暂停,然后向上回到原始位置)期间,旋转设备,从而旋转超视图。我想保持子视图的宽度与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.
}
答案 0 :(得分:1)
似乎没有可以在这里使用的自动调整大小的魔法。必须:
以下是一个示例项目供参考:http://d.pr/f/M4UW。
答案 1 :(得分:0)
您可以为图层的bounds
设置动画以更改宽度。只需使高度相同,并为边界应用动画。
如果您希望两个动画具有相同的持续时间,计时功能等,那么您可以将它们都添加到动画组中,并将该组添加到您要设置动画的图层。