Q:

Custom cell labels only showing when row is selectd

I'm building an iPhone app using swift with XCode6. I'm running into an issue where the labels I added to the cell only show when the cell row is selected. When the labels are moved outside the cells content view (e.g to the the nav bar) the labels appear. The default textLabel shows up fine, whether or not the row is selected. 
Here's an imgur with screenshots of interface builder + actual behavior. http://imgur.com/a/5fO4H
Code that defines the three non-static labels in custom cell class
  @IBOutlet  var posLabel: UILabel!
  @IBOutlet  var hrLabel: UILabel!
  @IBOutlet  var avgLabel: UILabel!

Code that sets label text
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
   let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as PlayerSelectTableViewCell

    let name = playerNames[indexPath.row]
    var hrs = Int(RosterStore.sharedInstance.get(name).stats["HR"]!)
    var avg = RosterStore.sharedInstance.get(name).stats["AVG"]!
    var avgString = "\(avg)" as NSString
    cell.hrLabel!.text = "\(hrs)"
    cell.posLabel!.text = RosterStore.sharedInstance.get(name).pos
    cell.avgLabel!.text = avgString.substringFromIndex(1)

    cell.textLabel!.text = name

    println(cell.hrLabel.text)
    return cell
}

Note that I can set cell.textLabel this way and it works. If it helps, textLabel is highlighted blue, while all the other labels are highlighted green.
Link to github here - https://github.com/klinskyc/OuttaHere
Thanks!

A:

Okay, thanks for posting on github.  I gotcha covered now.  The issue is with this statement:
cell.textLabel!.text = name

You are calling a text label of size you do not control over the top of everything.  It has transparency when highlighted.  Instead add another UILabel to your PlayerSelectTableViewCell class.
Code:
import UIKit

class PlayerSelectTableViewCell: UITableViewCell {

    @IBOutlet  var posLabel: UILabel!
    @IBOutlet  var hrLabel: UILabel!
    @IBOutlet  var avgLabel: UILabel!

    @IBOutlet weak var nameLabel: UILabel!  //new code here
}

Drop out the init and nib code from that class - not needed.
Back in your cellForRowAtIndexPath function:
 override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
       let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as PlayerSelectTableViewCell

        let name = playerNames[indexPath.row]
        var hrs = Int(RosterStore.sharedInstance.get(name).stats["HR"]!)
        var avg = RosterStore.sharedInstance.get(name).stats["AVG"]!
        var avgString = "\(avg)" as NSString
        cell.hrLabel!.text = "\(hrs)"
        cell.posLabel!.text = RosterStore.sharedInstance.get(name).pos
        cell.avgLabel!.text = avgString.substringFromIndex(1)
        cell.nameLabel!.text = name  //new code here
                return cell
    }

