Tuesday, September 5, 2023
HomeiOS Developmentswift - Easy methods to correctly align label and textual content area...

swift – Easy methods to correctly align label and textual content area in iOS/Xcode


I am making an attempt to align a number of components in my opinion controller in order that they align correctly on completely different display sizes. For the time being, I’ve headings (in blue) with labels and textual content fields in line. From the analysis I’ve finished evidently utilizing constraints is the best way to go. Nevertheless, in all of the examples I’ve seen, none appear to clarify how one can correctly add/alter these constraints if the weather are of various sizes.

Take for instance the connected picture. I can efficiently use constraints to align labels 1, 2 and three vertically and horizontally. Nevertheless, Textual content Area 1 shouldn’t be solely bigger (in peak) than label 2 nevertheless it additionally would not have the identical neighbor as Label 2 (the constraints for label 2 use label 1 as their neighbor whereas it appears the closest neighbor for Textual content Area 1 is the highest most margin). Moreover, label 4 could have the same situation as a result of the dimensions of its closes neighbor (Textual content area 1) is bigger than that of label 3 (whose closes neighbor is label 2).

To date I have been capable of set the relative positioning of those components within the storyboard in order that they’re all seen on all display sizes however that is inefficient and produces wasted house on the proper hand aspect of the display on bigger screens.

Can anybody provide options how one can obtain this? I am assuming there’s a easy approach to do that throughout the storyboard however have not figured it out but.

Xcode screenshot



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments