简体   繁体   中英

how to get UIImageView coordinates?

I have to calculate an angle beetween two UIImageView and i don't find how to get the UIImageViews coordinates(the four corners coordinates). Is there a property for that?

thanks

You should be able to find any angle with trigonometric functions.

For example, this will find the angle between the centers of two UIImageViews that share a superview:

angle = tan((imageView1.center.y-imageView2.center.y),
            (imageView1.center.x-imageView2.center.x));

It is important that they are in the same superview, otherwise the coordinates will be different. To find angles you need to have an understanding of basic trigonometry .

self.frame将为您提供带有视图坐标的CGRect。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM