swift - Get specific corner co-ordinates of UIView/UIImageView irrespective of its rotation -
i have simple uiimageview
of in screen follow:
to co-ordinates of highlighted corner of uiimageview
, use simple formula:
cgpointmake(cgrectgetmaxx(imageview.frame), cgrectgetmaxy(imageview.frame))
now rotate imageview
, looks follows:
after rotation, how can co-ordinates of highlighted point? because after rotation, previous code not applicable.
you can consult next link topic: transformation of coordinates involving rotation
https://www.math10.com/en/geometry/analytic-geometry/geometry1/coordinates-transformation.html
it applies cos , sin functions calculate (x,y) in new rotated coordinate system. need rotation angle.
Comments
Post a Comment