奇怪的行为使用基于视图的NSOutline(Sourcelist) [英] Strange behavior using view-based NSOutline (Sourcelist)

查看:201
本文介绍了奇怪的行为使用基于视图的NSOutline(Sourcelist)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个(新的在狮子)基于视图的NSOutlineView作为Sidebar SourceList在我的应用程序使用CoreData + NSTreeController + Bindings + NSOutlineView和一个对象作为NSOutlineViewDelegate。

I have a (new in Lion) view-based NSOutlineView as Sidebar SourceList in my app using CoreData + NSTreeController + Bindings + NSOutlineView and an Object as NSOutlineViewDelegate.

我在outlineview委托中使用这些委托方法:

I use these delegate methods in the outlineview delegate:

- (BOOL)outlineView :( NSOutlineView *)outlineView isGroupItem:

- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item In my case a item is group when the (Core Data) parent relationship is nil.

- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn :() NSTableColumn *)tableColumn item:(id)item 返回标题单元视图(组)或数据视图(图标+文本)。

- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item To return the headercell view (group) or datacell view (icon + text).

大纲样式(在XCode中的Interface Builder中)为Sidebar System Default,因此当用户在系统首选项中更改时,cellview会更改其大小。

And I set the size style of the outline view (in Interface Builder in XCode) as "Sidebar System Default" so the cellview changes its size when the user change it in the system preferences.

它工作正常...但有一些问题:

It works fine... but there are a few issues:


  • 第一个单元格视图是一个组单元格此单元格视图的文本字段上下移动。

  • The first cellview is a group cell (header cell) and when expand-collapse the textfield for this cellview moves up-down. Only happens with the first one.

标题单元格中的文本字段会更改其大小(当更改系统首选项中的大小时),但我希望

The textfield in the header cells changes it size (when changes the size in the system preferences) but I would like that the header cells size stay fixed like (Lion) Finder, Mail... does.

标题单元格中的文本字段的字符串值不会出现大写

The string value of the textfield in the header cells doesn´t appear uppercase.

我在数据单元格的图像视图中用作图标的图片显示为透明(带有0.5个Alpha值或类似值)。

The images I use as icon in the image view of the data cells appears transparent (with a 0.5 alpha value or something like that).

有任何帮助吗?提前感谢

Any help? Thanks in advance

已解决:


  • 第一次单元格视图展开/折叠使用方法 setFloatsGroupRows:NO 与大纲视图(感谢Anton!)

  • For the movement when the first cellview expand/collapse use the method setFloatsGroupRows:NO with the outlineview (Thanks Anton!)

groupcell的字体(即使用户在系统首选项中进行更改)在IB中将其单元格与其表单元格视图解除绑定。

If you want fixed size for the font of the groupcells (even if user change it in the system preferences) unbind in IB the header cell with its Table Cell View.

使用valueTransformer将字符串转换为大写)与标题单元格的字符串将出现大写。此外,您也可以使用nsoutlineview数据源方法执行此操作 - outlineView:objectValueForTableColumn:byItem: ...

Using a valueTransformer (that transform a string to uppercase) with the header cell the string will appear uppercase. Also you can do this with the nsoutlineview datasource method - outlineView:objectValueForTableColumn:byItem:...

半透明,因为没有启用。在图像单元格绑定中的值或值路径(取决于您使用的路径)中取消选中条件设置已启用。

And finally the icon is semi-transparent because is not enabled. Uncheck "Conditionally Sets Enabled" in the Value or Value Path (depending the one you use) in the image cell bindings

推荐答案

为大纲视图设置 setFloatsGroupRows:NO 必须解决第一组项目在展开/折叠时上下移动的问题。

Setting setFloatsGroupRows:NO for the outline view must solve the issue with first group item moving up-down when being expanded/collapsed.

这篇关于奇怪的行为使用基于视图的NSOutline(Sourcelist)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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