Layout still needs update after calling NSTableRowView layout

我是研究僧i 提交于 2019-12-05 14:47:30

I fixed it (or rather worked around it) by having the drop operation type not being allowed except for NSTableViewDropOperation.Above. Before a user could drop them onto other rows, not just between rows. But I want them to be only be allowed to be dropped between rows so that's fine with me. Here's 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;
}

In my case the warning was slightly different.

Layout still needs update after calling -[NSView layout]. NSView or one of its superclasses may have overridden -layout without calling super. Or, something may have dirtied layout in the middle of updating it. Both are programming errors in Cocoa Autolayout. The former is pretty likely to arise if some pre-Cocoa Autolayout class had a method called layout, but it should be fixed.

Different class NSView.

Anyway in my case, I could fix this by setting translatesAutoresizingMaskIntoConstraints == false of a NSScrollView.

For the record, autoresizingMask and autoresizesSubviews don't need to be touched at all.

The warning simply means that I have to set the property manually, otherwise it will produce wrong constraints. But figuring out the problematic object was very hard. I had to iterate all view nodes to check the property state.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!