English 中文(简体)
具有法律约束力的可可 观点一栏并非自动更新
原标题:cocoa binding on NSImageView in a NSTableView s column not update automatically

在我的可可观察中,只有一栏有“NSTableView(10.7 lion view based tableview)”,其中的电池是“NSTableCellView”,其中有一些观点,其中之一是“NSImageView”。

我的数据模型具有分类状态变量,我使用具有约束力的可可和一台NSValue Transformer来对这一NSImage意见作出不同的分类。

问题是,图像没有自动更新。 在情况发生变化后,图像仅反映重新填上清单后的变化。

感谢任何帮助:

最佳回答

最后,我解决了我自己的问题。

我补充了模型“状况”分类不动产的观察员。 当这一状况发生变化时,实际的表层单位icon(NSImageView)根据具有约束力的可可更改,但没有更新。 然后,在观察警报方法中,仅加一字。

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
Model *m = (Model*)context;
NSInteger idx = [self.modelArray indexOfObject:m];
NSTableRowView *row = [self.tableView rowViewAtRow:idx makeIfNecessary:NO];
ListCellItem *cell = [row viewAtColumn:0];
cell.icon.needsDisplay = YES;
[cell.icon.image recache];
[cell.icon display];
}

然后,一旦情况发生变化,图像就会得到更新。

问题回答

暂无回答




相关问题
Table view not updating according to bindings - Part Two

Title borrowed from this question, of which this one is not a duplicate. See my answer there for what was wrong for that questioner; I m the author of that answer, and my problem is not that one. I ...

Tinkering under the hood with Bindings in Xcode

Let s take two Core Data entities, set up as follows: Entity A: Car Attributes: year model Relationships: manufacturer (<<-> Manufacturer) Entity B: Manufacturer Attributes: ...

What is the Cocoa Touch equivalent to NSArrayController?

Been starting to work with Core Data a bit, and while I ve figured out how to use it in regular Cocoa applications, it seems it works a bit differently in Cocoa Touch. How do you bind entities to ...

Cocoa binding with @sum value of child

I m trying to have a table column to display the sum of child values using the IB. I m not sure if this is doable though. So I have my Core Data bind to a table and a column of "total sales amount" ...

Cocoa Core Data newbie how-tos

I am one of the great unwashed masses of .NET developers keen to try their hands at Mac OS X development. At the moment I am trying to figure out the various elements of Cocoa and getting a bit stuck ...

热门标签