Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. class ContainerViewController: UIViewController {
  2.  
  3. lazy var bubbleView: BubbleView = {
  4. let bubbleView = BubbleView(frame: CGRect(x: 80, y: 0, width: 160, height: 160))
  5. bubbleView.backgroundColor = .blue
  6. bubbleView.layer.cornerRadius = 80
  7. bubbleView.delegate = self
  8. return bubbleView
  9. }()
  10. override func loadView() {
  11. super.loadView()
  12. view.addSubview(bubbleView)
  13. }
  14. }
  15. extension ContainerViewController: BubbleViewDelegate {
  16. func userDidTap(into bubbleView: BubbleView) {
  17. let currentBounds = view.bounds
  18. UIView.animate(withDuration: 1.5) {
  19. var frame = bubbleView.frame
  20. frame.origin.y = currentBounds.height
  21. bubbleView.frame = frame
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement