Skip to content

Instantly share code, notes, and snippets.

@larssondaniel
Last active April 2, 2017 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larssondaniel/9a4fb3dcb30e77fe04ff7e0863f40f01 to your computer and use it in GitHub Desktop.
Save larssondaniel/9a4fb3dcb30e77fe04ff7e0863f40f01 to your computer and use it in GitHub Desktop.
- (void)panningBegan
{
if (self.playerViewAnimator.isRunning)
{
return;
}
CGRect targetFrame;
switch (self.playerState) {
case PlayerStateThumbnail:
self.originalPlayerViewFrame = self.playerView.frame;
targetFrame = self.view.frame;
break;
case PlayerStateFullscreen:
targetFrame = self.originalPlayerViewFrame;
}
self.playerViewAnimator = [[UIViewPropertyAnimator alloc] initWithDuration:0.5 dampingRatio:0.8 animations:^{
self.playerView.frame = targetFrame;
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment