iOS Swift - UITableViewCell Custom Subclass not displaying content

后端 未结 2 1643
被撕碎了的回忆
被撕碎了的回忆 2021-01-18 04:38

I have a UITableView that I\'ve created in a UIStoryboard that has two Dynamic Prototype UITableViewCells:

\"Scr

相关标签:
2条回答
  • 2021-01-18 05:14

    I had many hours in finding out, why my sample with the same issue as stated here wasn't working. I'm using story boards and swift 2 (xcode 7.2).

    Once I removed

    self.tableView.registerClass(AddListObjectTableViewCell.classForCoder(), forCellReuseIdentifier: "AddCell")"
    

    in viewDidLoad() it worked for me. I just used dequeueReusableCellWithIdentifier() as stated in this sample, filled the cell, that was it...

    Kind regards, Michel

    0 讨论(0)
  • 2021-01-18 05:15

    I believe it has to do with the sizing in Storyboard. It seems now it likes to default to a wider view and most people including me (and judging by your storyboard view width, you) prefer having the width set to 'Compact'.

    In storyboard either try setting your width/height to any/any or in the inspector for your labels inside the cells scroll all the way down and play the 'Installed' checkbox and you'll notice it has various options for the sizing class. If it's like mine, you'll have the first 'Installed' one unchecked and a second one for your sizing option checked. I removed the custom 'Installed' and checked the default one and then moved my labels into place.

    I don't believe I have enough reputation to post more than 1 image or 2 links, wish I could to explain what I mean easier.

    0 讨论(0)
提交回复
热议问题