I'm creating a map application in MKMapView, but I don't know where to rotate the map with the button.

Asked 2 years ago, Updated 2 years ago, 88 views

As the title says, I am creating a map application with MKMap, but I really need to rotate the map with a button, so I am having a hard time because I don't understand that part.I will post the code I tried, thank you.

let maxWidth: CGFloat=self.view.bounds.width
    let maxHeight —CGFloat=self.view.bounds.height

    myMapView.frame = CGRect (x:0, y:70, width:maxWidth, height:maxHeight-20.0-50.0)
    letangle: CGFloat=CGFloat(30.0*Double.pi)/180.0)
    myMapView.transform = CGAffineTransform (rotationAngle:angle)
    self.view.addSubview(myMapView)

swift ios xcode

2022-09-30 19:49

1 Answers

myMapView.camera.heading+=10

It's done with


2022-09-30 19:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.