Just to preface, this issue is similar to the problem of constraints being ignored in prototype cells, but I have tried all of the recommendations on this site and none have worked. I've tried:
- Autolayout is ignored in Custom UITableViewCell
- iOS TableView Constraints doesn’t work
- autolayout issue in some table view cell only
- Constraints not working in TableViewCell
- Autolayout is ignored in custom TableViewCell
My app uses xib/nib files, which I guess makes it even more of a pain for fixing.
I have set up the table inside of a UIView and included a prototype cell that is connected to the xib, like so:
I added constraints for each element and even made sure that xcode added any I forgot. I did not use stack view, because when I do it collapses everything on top of one another.
However, regardless of what I try, when I go to run it, I still get this:
The view, is a UIView in the Interface builder. The table is a UITableView. The prototype cell is a EpisodeTableViewCell (name of the xib). And the Xib is a EpisodeTableViewCell.
Attempts that did not work:
- Setting the prototype cell to standard UITableViewCell
- Removing the prototype cell
- Setting more constraints
- Setting stack layout
- Various attempts to more closely link the xib and the main views.
And some other stuff I've tried that I'm not remembering at this time. I've been trying to fix this for days now. I'm open to any new suggestions.
Thanks in advance.
UPDATE WITH XIB INFO
The xib is connected through the prototype cell and some code. The prototype cell is set as the name of the xib, but is also a button to direct the user to the next view.
episodeListTableView.delegate = self
episodeListTableView.dataSource = self
episodeListTableView.register(UINib(nibName: "EpisodeTableViewCell", bundle: nil), forCellReuseIdentifier: "SingleEpisodeTableViewCell")