2 つの NSTableView が埋め込まれた分割ビューを使用する OS X アプリがあります。1 つのテーブル ビューで値を変更すると、2 番目のテーブル ビューで関連する値が変更されるはずですが、これは起こりません。
グルー コードではなく、データ バインディングを使用して CoreData を使用します。TableView ごとに NSArrayController があります。最初のウィンドウには、最初の (左の TableView) に期待されるデータが表示されます。
American Travel <-- selected
Browse All
Fiction
Science Fiction
American Travel book に対応するデータが 2 番目 (右側の TableView)、つまり旅行本のリストに表示されます。これは、2 番目のコントローラーのコンテンツ セットが次のように設定されているためです。
leftController.selection.books
これは、TableColumns が正しいデータにバインドされていることを意味します。最初の TableView での新しい選択に続いて 2 番目の TableView を更新できないというこの問題に関連する警告は表示されません。Observer はシステムによって自動的にセットアップされ、Left ArrayController での選択の変更を監視すると思います。
チェックされた両方の ArrayController の属性インスペクターでは、次のとおりです。
Avoid Empty Selection
Preserve Selection
Select Inserted Objects
Auto Rearrange Content
RightController の単一の TableColumn の値バインディング - bookList
Bind to : RightController
Controller Key : arranged Objects
ModelKey Path : name
私の質問:
私が抱えている問題は、左/最初/ブックタイプのTableViewで選択を変更しても、右/2番目/ブック名のデータが変更されないことです。これを解決するにはどこを見ればよいでしょうか。チェックボックスのような非常に小さなものであることは知っています。私は単にそれを見つけることができません!
/// Begin Category.h
@class Book;
@interface Category : NSManagedObject {
}
@property (nonatomic, retain) NSSet * books;
@property (nonatomic, retain) NSString * name;// name of book_category
......
詳細情報 2011 年 4 月 13 日追加
I have added a button which is connected an action in the
LeftArrayController(Category) namely, selectNext: . When I click
the button, the selection in the CATEGORY TableView does not
visibly change, but the TableView on the right (Books) does change,
as the list of books on the Right continually changes.
If I click the TableView with the mouse, no selection change is done
either in effect on the RightTableView or in the visible
sense on the Left TableView. Why is the mouseClick not effecting a
visible change int the TableViewColumn? That is, why is the mouse
unable to change selection, whereas the button is able to.
There is only one column in the TableView. In Attributes Inspector I have
tried all combination of Empty,Column and Type Select for this single selection
Table. Is there no way around using NSTableView Delegate methods to set selection?