Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why UILabel's height become zero if doesn't hold any text?

I expected from the label to keep the minimal height of one line even if you remove the text out of it.

Here's the picture:

enter image description here

How it should look (but without whitespace):

enter image description here

If I enter the one whitespace in it, its height gets corrected. But I dont want to put whitespace into empty labels. there should be a better solution.

like image 793
Klemen Avatar asked Aug 25 '17 15:08

Klemen


1 Answers

The UILabel control have an intrinsic content size so if you don't have any text his height will be zero, If you need a min height then you must define a Height constraint with >= your minValue as I said in my comments

I think you can figured it out how do this

like image 54
Reinier Melian Avatar answered Sep 20 '22 11:09

Reinier Melian