0

I have an table row with 2 labels and 1 image view. Only one label and the image view are visible when I select the row.

When I view the table:

enter image description here

It looks perfectly right, but this is what I see when I select an row, the red dot is gone (but why?):

enter image description here

I have this at my storyBoard:

enter image description here enter image description here

Does someone know how to fix this issue? Because I want to 'see' the red dot always, even when selecting. I have tried to change the zPosition to 9999, but that didn't help. What is the issue here, as the other label and image view are normal.

Edit:

The cell code:

import UIKit

class DeviceViewCell : UITableViewCell {
    @IBOutlet weak var deviceImage: UIImageView!
    @IBOutlet weak var deviceDescription: UILabel!
    @IBOutlet weak var onlineStatus: UILabel!
}

The didSelect code:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    let cell = tableView.cellForRow(at: indexPath) as! DeviceViewCell
   }
}

The cellForRow code:

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell:DeviceViewCell = self.tableView.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as! DeviceViewCell

    cell.deviceDescription.text = self.roomObject.getDeviceAtIndex(index: indexPath.row).getName()
    cell.deviceImage.image = self.roomObject.getDeviceAtIndex(index: indexPath.row).getImage()


    return cell
}

I know what happens, the red dot is an label without text, but it has an red background color. The background color disappears when you select the cell. Does someone know how to prevent this behavior?

Solved the issue: UITableViewCell subview disappears when cell is selected

Community
  • 1
  • 1
da1lbi3
  • 4,369
  • 6
  • 31
  • 65

1 Answers1

-1

state : .Normal and state:Selected

see func tableview (rowDidSelect ...)

demopix
  • 159
  • 6