The layout still needs to be updated after calling the NSTableRowView layout.

I have two NSTableViews in my application, and the user can drag items from table A to table B. When dragging an item to table B, Xcode gives me the following warning message about placement:

The layout still needs to be updated after the call - [NSTableRowView layout]. NSTableRowView or one of its superclasses can have an overridden -layout without calling super. Or something might have a dirty layout in the middle of an update. Both are programming errors in CocoaAutolayout. The first one will most likely occur if some kind of pre- Cocoa Autolayout class had a method called layout, but it should be fixed.

This only happens when items are dragged into table B. Otherwise, I have no warnings about automatic layout in IB, and everything in the layout looks properly configured. Does anyone know that trying to tell me the above message? The tables use standard Cocoa classes (not subclasses).

+4
autolayout cocoa swift nstableview macos
source share
2 answers

I fixed it (or rather worked around it), not assuming that the type of the delete operation is not allowed, except for NSTableViewDropOperation.Above . Before the user can delete them on other lines, and not just between lines. But I want them to be allowed to simply be removed between the rows, so that it is perfect with me. Here is the code that fixed it:

 func tableView(aTableView:NSTableView, validateDrop info:NSDraggingInfo, proposedRow row:Int, proposedDropOperation operation:NSTableViewDropOperation) -> NSDragOperation { if (operation == .Above) { return .Move; } return .None; } 
+3
source share

In my case, the warning was slightly different.

The layout still needs to be updated after the call - [NSView Layout]. NSView or one of its superclasses may have overridden -layout without calling super. Or maybe something might be a dirty layout in the middle of updating this. Both are programming errors in Cocoa Autolayout. The first one will probably occur if some pre-Cocoa Autolayout class had a method but it should be fixed.

Different class NSView .

In any case, I could fix this by setting translatesAutoresizingMaskIntoConstraints == false to NSScrollView .

To write autoresizingMask and autoresizesSubviews don't need to touch at all.

A warning simply means that I must set the property manually, otherwise it will lead to incorrect restrictions. But to find out the problematic object was very difficult. I had to iterate over all view nodes to check the state of the property.

+1
source share

All Articles