Swift 3: UILabel not showing up in custom UITableViewCell

I have a custom UITableViewCell called CCLineupTableViewCell that looks like this:

 @IBOutlet weak var artistNameLabel: UILabel! @IBOutlet weak var artistValuationLabel: UILabel! override func awakeFromNib() { super.awakeFromNib() // Initialization code } override func setSelected(_ selected: Bool, animated: Bool) { super.setSelected(selected, animated: animated) // Configure the view for the selected state } 

I refer to the cell in the cellForRowAt indexPath: IndexPath as follows:

 let cell = tableView.dequeueReusableCell(withIdentifier: "HomeCell", for: indexPath) as! CCLineupTableViewCell 

My custom cell setup looks like this:

enter image description here

enter image description here

As you can see, it is correctly configured in IB and in code. It is strange that the first label artistNameLabel is accessible through cellForRowAt indexPath: IndexPath and works fine. artistValuationLabel , however, does not even appear, despite the fact that the default text is used in the storyboard.

Edit:

I added a constraint image from nib. It is tied to the right side, the top and bottom of the cell (as well as the format).

enter image description here

+5
source share
2 answers

Your mistake is a mistake in the restrictions that you set.

Add a width limit to make sure artistValuationLabel displays a space.

+3
source

Due to an incorrect width limit, this occurs. Either you need to add a proportional width, or you must run in the device for which you developed.

0
source

Source: https://habr.com/ru/post/1266234/


All Articles