Open hecode opened 7 years ago
So what is your custom table cell's height and width? And how you initialize this TagListView?
removing the trailing constraint on the taglistview fixes it, but causes the tagslistview to not fill the full width on iPad. (the tagslistview takes the same width as it does on iphone)
You can set priority to your constraint, depening on whether it is an iPad or iPhone.
sorry again, it seemed that removing the constraint fixes it, but while trying other data and trying the uidebugger it actually just crams the tags in a width smaller than the cell width. so unfortunately still have the same problem.
I am facing the exact same issue. I have a UITableViewCell nib with TagListView
in it which is inside a Stack view and the stack view is pinned 8 pts to Top, Bottom, Leading and Trailing of the tableviewcell's content view. No matter what I do, there seems to be this extra space at the bottom of the TagListView
which I am unable to get rid of. By the way my Tableview uses tableView.rowHeight = UITableViewAutomaticDimension
so it will expand/shrink based on it's content, so i don't believe it's a table view cell height issue. I have other Custom tableview cells with variable heights and they all operate correctly except for this one which is slightly taller.
Take a look at the implementation of rearrangeViews
. The number of rows is determined using the cell's actual frame. If you are using UITableViewAutomaticDimension
, chances are rearrangeViews
is called before the cell's proper width is set (and it uses the width which is set in the xib file).
Something like this can fix your issue:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
...
let cell = tableView.dequeueReusableCell(withIdentifier: "TagsCell", for: indexPath) as! TagsCell
cell.contentView.frame.size.width = tableView.frame.width
cell.contentView.layoutSubviews()
tagListView.addTags(tags)
...
}
@hegedus90 I've found a rather hackish way of solving the problem, but I will give this one a try. It also looks like if used in a tableview cell then this delegate is necessary otherwise the list tags just keeps on adding everytime the cell is dequeued and queued back again.
override func prepareForReuse() {
tagListView.removeAllTags()
}
as you can see there is a third row that is empty after the two full rows.
the taglistview is in a view in a custom table cell, and is using the following settings
using swift 3 version