I have an UIView in my Storyboard. Leading and Trailing is 16, width of the element is not fixed.
I am appending UILabels to this UIView (-container), which will move to the next "row", when the new and existing UILabel exceeds the width of the container. The "containerWidth" (UIView.frame.size.width) is 382.
**// If current X + label width will be greater than container view width
// .. move to next row**
if (currentOriginX + labelHashtag.frame.width > containerWidth) {
currentOriginX = 0
currentOriginY += tagHeight + tagSpacingY
}
It works fine for iPhone XSM:
But when I run my code on an iPhone 8, the container width is still 382 and the UILabels appearing out of my screen:
Why is the size of my UIView always the same? Why is there no automatically resizing when I use constraints, depending on the device?



labelHashtag.frame.width- Ram