Alexandru Vasiliu Alexandru Vasiliu - 7 months ago 38
iOS Question

Custom cells labels and button appear only when tapped

I am developing a Swift application. I have 2 tables which I populate them from file. My problem regards the 2nd table which displays the labels and buttons only when pressed. If I press the cell, the labels and buttons appear, as soon as I stop tapping the cell, they dissapear. I want the buttons and labels be available without being tapped.


You have your code to spawn the buttons in the .init of your UITableViewCell However you never use this initializer in your cellFoRowAtIndexPath

If you move the initialization of your cell in a separate function for example configureCell() and call that function from every initializer in the custom class. For example:

override func awakeFromNib() {

Then you should have no problem