Skip to content

Instantly share code, notes, and snippets.

@mitchellporter
Created May 25, 2016 19:27
Show Gist options
  • Select an option

  • Save mitchellporter/9dcffc3f0243e5463eb7834b3a10ad51 to your computer and use it in GitHub Desktop.

Select an option

Save mitchellporter/9dcffc3f0243e5463eb7834b3a10ad51 to your computer and use it in GitHub Desktop.
layer anim
UIView.animateWithDuration(1.0) {
// Option 1: Animate the player layer
playerLayer.frame = toViewController.view.bounds
// Option 2: playerLayer is a sublayer of the container view
containerView.frame = toViewController.view.bounds
}

ghost commented May 25, 2016

Copy link
Copy Markdown
let viewBounds = toViewController.view.bounds
let anchorPoint = playerLayer.anchorPoint

playerLayer.bounds = viewBounds
playerLayer.position = CGPoint(x: (CGRectGetMaxX(viewBounds) * anchorPoint.x), y: (CGRectGetMaxY(viewBounds) * anchorPoint.y)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment