Place button on ImageView - adjust position regardless of size

Hello all,

I am currently facing a problem,

I have an ImageView on a view. Buttons for user interaction should be placed on it at different positions. The buttons must always remain at exactly this position on the image, no matter how large the mobile / the image is scaled.

Unfortunately I haven't found a solution yet that could help me.

As an example of what my problem is currently I have inserted two images. On the first picture (size Iphone 11) the button is fitting on the picture.

On the second (size Iphone SE) however the button is no longer where it should be.

I hope that you can help me.

Greetings Dominik

Picture 1:

Picture 2:

You have to compute it.

In a reference image (some iPhone model), compute at what % of the full image, from the top, should it be.

Use this to reposition using a constraint IBOutlet for the button.

Do the same for horizontal.

And scale the button size.

Place button on ImageView - adjust position regardless of size
 
 
Q