Skip to content

Instantly share code, notes, and snippets.

@andresbrun
Last active December 23, 2016 08:59
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 andresbrun/2accf5751eccb1b4cdcde0d3275ec2dc to your computer and use it in GitHub Desktop.
Save andresbrun/2accf5751eccb1b4cdcde0d3275ec2dc to your computer and use it in GitHub Desktop.
class BallView: UIImageView {
init(size: CGFloat) {
super.init(frame: CGRect(origin: .zero, size: CGSize(width: size, height: size)))
image = UIImage(named: "basketball-png-0")
contentMode = .scaleToFill
layer.cornerRadius = size * 0.5
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override var collisionBoundsType: UIDynamicItemCollisionBoundsType {
return .ellipse
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment