문제

I'd like to display in (real world) mm/cm the distance (only on the y axis) between 2 images that can travel on the y axis. I've thought long and hard about this but can't think of a reasonable way to this given my inexperience (go easy on me! I'm new to development). If someone could help me out, that would be fantastic.

도움이 되었습니까?

해결책

1 cm = 47 pixels and it is easy to find distance between 2 images in pixels..

so you can then convert pixels into centimeter ,like you have 200 pixels of distance then your centimeter will be like ---> (200/ 47) = 4.25 centimeter

int distance = imageview1.frame.origin.y - imageview2.frame.origin.y;

int pixeltoCentrimeter = distance/47;

Happy Coding!!!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top