Skip to content

How to zoom in the view & rotate ? #45

@chajmz

Description

@chajmz

Hi I'm trying to make your view rotate & zoom.
For the zooming part I can implement the gesture in the viewDidLoad :

let gesture = UIPinchGestureRecognizer(target: self, action: #selector(pinchAction(sender:))) self.drawView.addGestureRecognizer(gesture)

and adding this function :
@objc func pinchAction(sender:UIPinchGestureRecognizer) { let scale:CGFloat = previousScale * sender.scale self.view.transform = CGAffineTransform(scaleX: scale, y: scale); previousScale = sender.scale }

  • adding the variable

var previousScale:CGFloat = 1.0

but my strategy isn't working for the rotation (or translation ?) since it's not detecting this as a proper rotation event ?

Do you have any idea how to fix this ?

Thanks for you repo & awesome work by the way !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions