cocoa-bindings

Core-Data Check Box Cell with many-to-many data

*爱你&永不变心* 提交于 2019-12-13 04:47:47
问题 i've got a Core-Data model like this (just an example): Now i'd like to have a window where a user can select the ingredients of the drink from every ingredient. like this: How can i achieve this? Thanks, Thomas Günzel 来源: https://stackoverflow.com/questions/12372874/core-data-check-box-cell-with-many-to-many-data

Is it possible to bind an NSTreeController to an NSOutlineViewDataSource?

試著忘記壹切 提交于 2019-12-13 04:09:22
问题 I have some hierarchical data model that I'd like to present in an NSOutlineView. I'm binding a tree controller to the outline view to provide data and to handle selection and binding to other views. However, I only want to show only part of the data in my model to the outline view. (Each object in my hierarchy has an array of child objects, but I'd only like some of these child objects to appear as child nodes of the node in the tree.) I wish I could just attach a filter predicate to the

NSWindowController circular dependency caused by bindings?

流过昼夜 提交于 2019-12-12 19:12:20
问题 Suppose you have a window nib, owned by a NSWindowController which loads the nib. The NSWindowController has an IBOutlet bound (via Interface Builder) to a UI control on the window. Is it true that you can't dispose the window controller by releasing it because the binding causes a unbreakable circular dependency between the window controller and the control? Do you know any common situation which may lead to similar circular dependencies? 回答1: In situations like this, writing a focused

Cocoa Bindings: Binding to the “many” end of a to-many relationship

╄→尐↘猪︶ㄣ 提交于 2019-12-12 13:48:29
问题 Using the Employees-Departments example what I want to do is bind a column to "Departments.arrangedObjects.employees.@sum.hoursWorked" as outlined below: Entity Employee attributes: "firstName", "lastName", "hoursWorked" relationship: "departments" Entity Department attributes: "name" relationship: "employees" I want a table which will display some summary info about departments. I bind the first column to my "Departments" array controller, "arrangedObjects.name". I can have a column

Cocoa binding to a particular item in an array controller

会有一股神秘感。 提交于 2019-12-12 12:07:28
问题 Is it possible using NSArrayController to bind a NSTextField 's value to a particular item in the array? In particular, I want to bind to a property on the first item in the array, and show nothing if the array is empty. Using arrangedObjects.command shows just "(" -- presumably it's trying to show a multi-line string with comma-separated strings for each item. I just want the first one. 回答1: Bind the text field to selection.command , and programmatically set the array controller's selection

Binding an NSMenuItem's title breaks enabled/disabled validation

99封情书 提交于 2019-12-12 10:37:47
问题 I have a menu where some of the menu items use bindings to get their title. These items are always enabled, and don't neither automatically enable/disable like they should NOR do they cause a call to validateUserInterfaceItem:. If you remove the binding on title, then that starts working again. The menu items have the target set to nil (First Responder). If you click on one, it does execute the selector (action). Bug? What to do? 回答1: For some reason when you set a menu item's title with

Sectioned NSTableView using NSArrayController

你。 提交于 2019-12-12 07:49:32
问题 I'm trying to create a sectioned NSTableView using NSArrayController and cocoa bindings. I'm searching for a similar approach like with NSFetchedResultsController in iOS, where you can set a section key path. I want to make something similar with NSArrayController . I give you an example: I have different tasks. Each task has one of three different priorities, low, medium or high. The tasks also has attributes like title, description, date, etc. I want to section or group the tasks by

NSOutlineView and NSTreeController example

醉酒当歌 提交于 2019-12-12 07:46:22
问题 Please send me some links on how to use NSOutlineView with NSTreeController bindings without using core data. 回答1: In addition to the documentation, Apple's sample SourceView project should help you better understand things: "SourceView" is a Cocoa application that demonstrates how to use NSOutlineView driven by NSTreeController and various other Cocoa classes to produce a Finder-like left column source view. Among the key features used to imitate this commonly used view are the use of

Cocoa Core Data newbie how-tos

痴心易碎 提交于 2019-12-12 07:09:22
问题 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 on Core Data. I noticed most of the documentation and resources available on the Web involve a broad end-to-end tutorial, beginning from models, generating classes, Document-based UI, etc. Not enough seem to be focused on each bit, or at least not enough examples. Can someone please point me in

Is it safe to use Interface Builder bindings to observe properties changed on non-main thread?

元气小坏坏 提交于 2019-12-12 05:44:57
问题 If I use Interface Builder to bind, e.g. NSTextField 's value to someObject.property and this property (assuming it's assign, atomic type) will change from a non-main thread, will this be safe/correct? Cocoa generally forbids updating UI from non-main thread, so I wonder whether the binding mechanism automagically schedules updates to happen on the main thread for me, or is it unsafe to bind directly to objects that may be changed from other threads. Does the same hold true if I fire KVO