2

The UIView is a topBar who is used to dismiss the UIViewController. If there is no animation for the topBar, it show and hides well. But When a slide animation was add to the topBar, it flashes when the animation executes.

And strangely, if I pause the AVPlayer, the topBar's animation works well, every time I tap the screen, the topBar shows and hides with a slide animation correctly.

Why the AVPlay's playing or pause status will influence the behavior of the tapBar(a UIView on the AVPlayer) ?

And How could I make the animation works well ? The screenshot with the UIView and AVPlayer

    __weak typeof(self) weakSelf = self;

    CGRect topBarViewFrame  = weakSelf.topBarView.frame;

    if( self.topBarView.hidden ){

        // show control UIView
        self.topBarView.hidden  = NO;
        self.controlView.hidden = NO;

        [UIView animateWithDuration:0.35f animations:^{

            __strong typeof(weakSelf) strongSelf = weakSelf;

            strongSelf.topBarView.frame = CGRectMake( topBarViewFrame.origin.x, 0, topBarViewFrame.size.width, topBarViewFrame.size.height);

            strongSelf.controlView.alpha = 1.0f;

        } completion:nil];


    }else{

        // hide control UIView

        [UIView animateWithDuration:0.35f  animations:^{

            __strong typeof(weakSelf) strongSelf = weakSelf;

            strongSelf.topBarView.frame = CGRectMake( topBarViewFrame.origin.x, - topBarViewFrame.size.height, topBarViewFrame.size.width, topBarViewFrame.size.height);

            strongSelf.controlView.alpha = 0.0f;

        } completion:^(BOOL finished) {

            __strong typeof(weakSelf) strongSelf = weakSelf;

            strongSelf.topBarView.hidden  = YES;
            strongSelf.controlView.hidden = YES;

        }];

    }
William
  • 59
  • 1
  • 8

0 Answers0