NEW: Subscribe to Hacking with Swift+ and accelerate your learning! >>

How to compensate for the movement ArchorPoint

Forums > Swift

Good day. I just can’t understand how to compensate for the change ArchorPoint? I will be grateful for the clarification


Did so

       box.layer.anchorPoint = convertPoint(points: CGPoint(x: 0, y: 1))



    func convertPoint(points: CGPoint) -> CGPoint {
        let ss = points
        let oldOrigin = box.frame.origin = oldOrigin
        box.layer.anchorPoint = ss
        let newOrigin = box.frame.origin = newOrigin
        let changeOrigin = CGPoint(x: newOrigin.x - oldOrigin.x, y: newOrigin.y - oldOrigin.y) = CGPoint(x: - changeOrigin.x, y: - changeOrigin.y)
        return ss


Hacking with Swift is sponsored by Paw

SPONSORED Use Paw to build, test and describe web APIs. Paw has a lightning fast native macOS interface to compose requests, collaborate in real-time on API specs, and generate client code for your applications. You can import and export API definitions.

Discover Paw for Mac

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

Not logged in

Log in

Link copied to your pasteboard.