Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fabrum

macrumors member
Original poster
Jan 15, 2021
47
3
I have a UIView with a static image and associated with several different parts of the image are text Labels. My problem is that the distance relationship between the Labels and the parts of the static image changes according to device screen size. I fiddle with the constraints using some set manually and I tried also letting Swift do it automatically. Nothing works.

How can I solve this problem so that the labels stay on top of the image near the parts of the image where I want them to be? thanks
 

xStep

macrumors 68020
Jan 28, 2003
2,031
143
Less lost in L.A.
For anyone to help you, details are needed.

What tech are you using to align everything? Auto Layout, SwiftUI, Rects, storyboards, XIBs?

If code, then cut and paste it into here with a detailed description.

Lack of detail typical gets you no or poor responses.
 

prime17569

macrumors regular
May 26, 2021
192
490
It appears that you're using Interface Builder. Could you post a screenshot of your storyboard/XIB and the relevant constraints? Also, please make sure to expand all elements of the tree view in the left pane of Interface Builder so that we can get a better picture of how things are laid out in your view.

Another option, if your labels are static, would be to use Inkscape or some other kind of SVG editor to create your labeled image as an SVG vector image so that the text is always crisp. Xcode 12 and newer support SVG assets in asset catalogs. If you choose to do this, remember to turn on "Preserve Vector Data" for that image in the asset catalog editor. Then, you can use a UIImageView to show your labeled image.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.