UINavigationControoller - setNavigationBarHidden:a

2019-05-03 12:11发布

How can I capture the animation curve and speed when I hide the navigation bar programmatically? I would like to sync other animations with this one for a fluid transition :)

2条回答
相关推荐>>
2楼-- · 2019-05-03 12:41

Below is a code snippet for those who would like to take the advice of the accepted answer, but don't know how to go about it :)

 [self.navigationController setNavigationBarHidden:YES animated:YES];
 [UIView transitionWithView:self.view 
                   duration:UINavigationControllerHideShowBarDuration
                    options:UIViewAnimationOptionCurveLinear
                 animations:^
  {
   /* Put other animation code here ;) */
  }
                 completion:^(BOOL finished) 
  {                                  
  }];
查看更多
闹够了就滚
3楼-- · 2019-05-03 12:55

If you check the UINavigationController documentation there is this line:

For animated transitions, the duration of the animation is specified by the value in the UINavigationControllerHideShowBarDuration constant.

查看更多
登录 后发表回答