调用NSTableRowView布局后布局仍然需要更新 [英] Layout still needs update after calling NSTableRowView layout

查看:527
本文介绍了调用NSTableRowView布局后布局仍然需要更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个NSTableView的在我的应用程序,用户可以将它从表格中的掉落物品表B.当拖动某一项表B X code给出我下面的布局警告消息:

I have two NSTableView's in my app and the user can drag and drop items from table A to table B. When dragging an item to table B Xcode gives me the following layout warning message:

布局调用后仍需要更新。
  NSTableRowView或其超类中的一个可能已经覆盖-layout
  无需调用超。或者,一些可具有在脏布局
  更新它的中间。两者都在可可编程错误
  自动版式。前者是pretty可能发生,如果一些pre-可可
  自动布局类有一个名为布局方法,但它应该是固定的。

Layout still needs update after calling -[NSTableRowView layout]. NSTableRowView 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.

这曾经只在项目拖到表B.发生了,我都没有,否则在​​IB自动布局警告,一切都在布局看起来像是被正确设置。是否有人知道上述消息要告诉我吗?该表采用标准Cocoa类(而不是子类)。

This ever only happens when items are dragged to table B. I have otherwise no auto-layout warnings in IB and everything in the layout looks like being set up correctly. Does somebody know what the above message is trying to tell me? The tables are using standard Cocoa classes (not sub-classed).

推荐答案

我固定它(或者更确切地说,它周围的工作),由具有拖放操作类型没有被允许,除了 NSTableViewDropOperation.Above 。之前,用户可以把它们的的其他行,不只是行之间。但我希望他们只被允许行之间被丢弃,这样的罚款我。这里的code,它固定它:

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;
}

这篇关于调用NSTableRowView布局后布局仍然需要更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆