サブビューのスライドアニメーション(下、一時停止、上に戻る)中に、デバイスが回転するため、スーパービューが回転します。サブビューの幅をスーパービューと同じに保ちたいので、スライドアニメーション中にサイズを変更する必要があります。
スライドアニメーションコードは次のとおりです。
[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.
}