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 access the cell in the cellForRowAt indexPath: IndexPath
method like so:
let cell = tableView.dequeueReusableCell(withIdentifier: "HomeCell", for: indexPath) as! CCLineupTableViewCell
My custom cell setup is like so:
As you can see it's setup right in the IB and in the code. The weird thing is that the first label, artistNameLabel
, is accessible through cellForRowAt indexPath: IndexPath
and works perfectly. The artistValuationLabel
, however, never even shows up despite having default text via the storyboard.
Edit:
I've added a picture of the constraints from the nib. It's anchored to the right side, top, and bottom of the cell (as well as the aspect ratio).
Your mistake is an error on the constraints you did set.
Add a Width constraint to make sure that artistValuationLabel
will have space to appear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With