Why does IB display tvOS tableview cells with crazy frames?

My tvOS App has not been updated since the XCode 7 (maybe 8) - now, using XCode 9, I open a XIB with a UITableViewCell (or, create a new UITableViewCell in a new project - same thing) - the depiction of the cell and its subviews in IB is crazy. Details follow about each crazy thing I am seeing.


1. This seems like a big one - the "contentView" in the table view cell is always more narrow than the width of the tableview cell it is contained in - maybe I am expecting things to work like iOS, I've made hundreds of custom table view cells for iOS Apps, is there some conceptual difference with tvOS I am missing? The content view is created automatically by IB. If I set my table view cell width to be 1920, the contentView is always 1700. As seen here. (https://i.imgur.com/vNSDlOh.png).



2. When I select any object in IB, it displays that objects frame offset to the left, while rendering the content of the object to the right, as seen here.

(https://i.imgur.com/SkYRL5A.png)

Note here, you can see the 8 anchor points for the 4 corners and 4 sides of the selected collection view, but you can see the constraints cause the collection view to be centered, and, you can also see the actual position of the collection view rendered as a light-gray/whiteish rectangle in the center of the cell! The anchor points and the blue selection rect are offset to the left by 110px (which is half the distance left over in the "margin" to the right where the content view fails to extend fully the width of the cell view, as described above!).



3. This last screenshot (https://i.imgur.com/GmpeodK.png)shows the title label and the collection view selected - note again that the selection rect and the anchor points for the UILabel are offset to the left of where the lable is actually rendered.


I've been working with IB for iOS Apps since 2012 (and before that without IB) and I have never seen anything like this. And, when I first developed this tvOS App 2 years ago, I am certain this was not the state of things with IB, I am certain at the time it was a WYSIWIG situation, as it is when designing views for iOS. Has something changed in XCode? Have I failed to account for some new option or setting or layout configuration?



What gives? How is anyone supposed to use IB under these conditions, or, is this ONLY happening to me (and one other guy 2 years ago: https://forums.developer.apple.com/thread/88847?q=tvos).

I have the exact same issue. Did you find any solution?


So weird that no one answered your post and to the other post which is posted 2 years ago. It is impossible to use IB in this situation..

I have the same issue...


This problem occurs with everyone I know and no one knows the reason.


Anyone help us, please!

Here I am, 6 months later, had to create a new tableview cell, and guess what, same ****. Searching for guidance, I find my OWN POST from 6 months ago with 2 other people with the same problem, and no answer. Does Apple even monitor these forums?

Just submitted this as a bug report to apple as I am having the same problems. Completely unworkable, guess we have to create the cell programmatically for now...


UPDATE: Apple has responded and said it was a duplicate bug report, so it appears they are currently working on it. No known estimate at this time.

I am have the exact same issue. I am a little embarressed to admit this but my solution is to offset in code ...


self.contentView.frame.origin.x = self.contentView.frame.origin.x - 30


#dontjudgeme

This is a really bad bug...


I have recently refactored an application I am working on from having everything in a storyboard to haveing everything in distinct .xib files and encountered this issue with UITableViewCells in IB.


My solution was to use the old trick of creating an "Empty" xib, adding a root view and setting that to my UITableViewCell custom class.


This allows you to easily adjust the size of the view in in IB and create layouts as you would expect...


HOWEVER, I now get a warning when running the app: "WARNING: an instance of MyTableViewCell was saved from IB without a contentView. This is unsupported for apps linked against tvOS 11.0 and later. Please re-create the cell in IB, starting with a UITableViewCell isntance".


This is dumb. I CAN"T RECREATE THE CELL IN IB using a UITableViewCell... IB keeps changing the size and makes it almost impossible to layout things out.


This is dumb.


Is this specific to tvOS only, or does this also occur for iOS UITableViewCells created as xib files?

Just to follow up this issue, same thing happening just now (Jul 16th 2020)...

I wasn't able to set UITableViewCell properly in IB and it gets me wrong frames, and margins, constraints, etc... Nothing is being rendering correctly even using the guide provided by the IB... Along with this issue, it doesn't matter which width do I use, it always throws a warning about to resize the cell from current to expected value and every time i go to the "Fix misplacement/update constraints" i get the same warning with new values. (lol).

However i decided to create collection view for everything (more work for layout), but now UICollectionViewCell is working right in IB :D.

Other approach i was doing before UICollectionvViews is to create UITableviewCell from code and attach to the content view a custom UIView Designed in IB and add constraints through code. (but i think this may confuse future developers so i migrated everything to collection view).

Why does IB display tvOS tableview cells with crazy frames?
 
 
Q