且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

NSOutlineView不执行其子类应具有的功能

更新时间:2022-03-08 07:37:33

如果在IB中实例化大纲视图,则需要在Windows中将大纲视图的类名设置为 MyOutlineView身份检查器。记住双击控件,以便选择内部矩形,并且检查器窗口的标题为 Outline View Identity;单击控件只会选择滚动视图(在滚动视图中嵌入了大纲视图)。

If you instantiate the outline view in IB, you need to set the class name of your outline view to "MyOutlineView" in the Identity inspector. Remember to double click on the control so that the inner rectangle is selected and the Inspector window title is "Outline View Identity"; a single click of the control will only select the scroll view (an outline view is embedded in a scroll view).

如果您以编程方式创建大纲视图,只需确保实例化 MyOutlineView 而不是 NSOutlineView

If you create your outline view programmatically, just be sure to instantiate a MyOutlineView instead of an NSOutlineView:

MyOutlineView *outlineView = [[MyOutlineView alloc] initWithFrame:rect];

其中 rect 是轮廓框架视图。