unembed command is destroying the subViews?

I am IN IB, and I decide I no longer need a splitView.

it's got 2 views, and I only need one of them. It's a collectionView and it was **** to setup properly.


so I select the splitView, and select unembed from the editor menu.


the splitView sure enough, goes away.


but now my ColelctionView is 2 pixels by 17 pixels... and I am NOT allowed to change it's dimensions... in any interface. dragging, typing in a new size... nothing works.I've tried deleting EVERY SINGLE CONSTRAINT in the file, and then unembedding. didn't help. What the heck is going on?

Replies

You mean, when you select the collectionView, in the view panel, you cannot edit height or width ?


Have you set a custom class for it ? If so, what about returning to UICollectionView default for a moment ?

this is an NSCollectionView.

i mean (and I'd post video if this forum wasn't so stingy) there is no way to change the dimensions of the collectionView at all...


you cannot select it and drag it's handles to a new size. during the drag it previews a new size, and then at the end of the drag it reverts to teh same 17 x 2 size it's stuck at. In the sizing property panel, you can type in a new size. The edit is reverted and ignored.


this is an Off-The-Shelf, NSCollectionView. I have not written a subclass. I am only including it's nature as an illustration that I cannot afford to rebuild it (nor should I be forced to do so) the same thing happens to _ANY_ view class that you embed in a ui element, and then try to unembed. except custom views. instances of NSView are not affected. It will take more testing, but my initial expectation is that the view hierarchy is being screwed up with the unembed command. custom NSViews don't have subViews.

This comes too late to help the original poster, but perhaps it will help someone else.


This bug occurs not only with NSCollectionView. It occurs whenever one of the subviews of a split view itself has a subview. It is easy enough to reproduce, and there is no way to fix this within Interface Builder. This is an old bug, which I encountered years ago, but at that time was not able to solve.


Make a copy of the xib file before unembedding the split view. Do the unembed and save the file, which is now totally corrupted. Next, open the copy and the corrupt version in a text editor, so that you can look at the XML. The corrupt file will have view frames that are very strange, with heights and widths that are zero, or y coordinates that are large negative numbers. Many views will have no frame property at all, which is probably why the frames cannot be fixed in Interface Builder. Luckily, all the missing and corrupted frame rects have valid properties in the original file, the copy you made before the unembed. Simply copy these frame rects from the original file to the corrupt file and save. Voilà. The previously corrupt file now opens correctly. You may have to move things around, or reapply constraints to get things back to where they should be. But this fix enables you to edit the layout normally again.