Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the actual translation of a uiview

I have an uiview in which I draw my own map with a dimension of say 1000 * 1000.

I am moving and scaling the map with CGAffineTransform....... (Translate, Scale) transformations.

Lets say the upper left coordinate of my map after translation is 20 (x),10(y), because I translatet the map 20 to the left and 10 up.

Is there a way to get the coordinate of the upperleft corner of my map from the view ? (I know I could maintain my own metadata for this and update my metadata after a translation by my self.)

like image 976
mcfly soft Avatar asked Dec 29 '25 20:12

mcfly soft


1 Answers

extension CGAffineTransform {

    var translation: CGPoint {
        return CGPoint(x: tx, y: ty)
    }

}
like image 77
amleszk Avatar answered Jan 01 '26 11:01

amleszk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!