Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permanent Misplaced View warning for Clip View in NSTableView

My application has a log window that displays lines in an NSTableView:

Window > View > Bordered Scroll View - Table View > Clip View > Table View

When I add auto layout constraints to the window no matter what I do I get a Misplaced View warning for the Clip View:

Misplaced View warning

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.

like image 340
MagerValp Avatar asked Sep 21 '14 09:09

MagerValp


3 Answers

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.

like image 182
Tyler Liu Avatar answered Nov 19 '22 18:11

Tyler Liu


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.

like image 2
uchuugaka Avatar answered Nov 19 '22 19:11

uchuugaka


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.

like image 1
morph85 Avatar answered Nov 19 '22 19:11

morph85