My application has a log window that displays lines in an NSTableView:
When I add auto layout constraints to the window no matter what I do I get a Misplaced View warning for the Clip View:
I've tried updating its frame, updating its constraints, and resetting to suggested constraints, but nothing gets rid of the warning. The window displays and resizes correctly at runtime, and it doesn't even appear to be possible to add constraints to the Clip View itself.
I've pushed the code to github if you want to look at it in Xcode: https://github.com/MagerValp/AutoDMG/tree/e57b0140e3fc3f7f9e0d4550341ed249a6cf5378. The code requires the 10.10 SDK to compile, but the xib should be viewable in Xcode 5 and up.
I met the same issue recently, warning about Clip view expected value is 17px larger than actual value.
I believe it is a bug of Xcode. And I do find a workaround to fix it(other than downgrading my OS to 10.9).
The solution is to edit the attributes of tableView in IB, disable "Headers". Don't show table headers and the warning will be magically gone. And we can guess that by default the table header is 17px :)
It's just a workaround, not an ideal solution. This is not our fault. The best solution is to wait for Apple to fix this Xcode bug.
Scrollviews' subview hierarchy are only sort of compatible with auto layout.
One way around this is to constrain the clip view so it is not bothering you. Then in the inspector, mark those constraints to be removed at runtime.
ScrollCiew
ClipCiew
TableView
If the error is coming from ClipView. Check the ScrollView size, remember it. And then click ScrollView as target, open up size inspector, enable Intrinsic Size using Placeholder with ScrollView size.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With