組み込みの iOS システム アニメーションのアニメーション プロパティ (速度とイージング カーブ) を取得することは可能ですか? 具体的にはUIStatusBarAnimationSlide
、ステータス バーを表示または非表示にする場合です。現在、私はちょうどそれを観察していて、良い一致を思いつきました: デフォルトのアニメーション カーブを使用して .35 秒です。これは問題なく動作しますが、Apple は将来の iOS アップデートでこのようなアニメーションを変更する可能性があります。正確に一致させ、私が思いついたハードコードされた値に依存しないようにすることをお勧めします。
For what it's worth, here is the method my view controller is calling when I tap the view to hide the status bar and resize the view to fill the screen.
-(void)tappedView:(UIGestureRecognizer *)gestureRecognizer
{
UIApplication *app = [UIApplication sharedApplication];
// First, toggle the visibility of the status bar
[[UIApplication sharedApplication] setStatusBarHidden:![app isStatusBarHidden] withAnimation:UIStatusBarAnimationSlide];
// Then scale this view controller's view, attempting to match the built-in
// UIStatusBarAnimationSlide animation
[UIView animateWithDuration:.35
animations:^{
self.view.frame = [UIScreen mainScreen].applicationFrame;
}];
}
As an aside, I'm surprised I couldn't find a built in way to handle resizing a VC's view when the status bar is hidden. After all, if the status bar doubles its height when a call is in progress, the view resizes automatically. Tell me I'm missing something and there's a way to get the view to grow automatically, too.