cocoa-bindings

NSCollectionView Master detail binding configuration

爷,独闯天下 提交于 2019-12-25 03:58:06
问题 I have the following models in my application. Board , holds a NSMutableArray property lists of type List below List , holds a NSArray property cards of type Card below Card , has a NSString property name The relationship is thus Board --> to-many List --> to-many Card I have a NSCollectionView based master-detail interface, where I want to display Boards in the master and its corresponding Lists+Cards in the detail view. The master interface is fine, the elements Board are displayed nicely.

Simple NSTableView bindings example

二次信任 提交于 2019-12-24 07:26:21
问题 I am trying to populate a 2-column NSVTableView via bindings, but the data is not showing up in the table. In XCode: I have a NSMutableArray in my AppDelegate that will hold the data, as well as the corresponding @property and @synthesize. On an event, I call [removeAllObjects] on the NSMutableArray and repopulate it with some NSDictionary objects. Each dictionary contains 2 KVP's: a NAME and a VALUE. In IB: I added an NSArrayController and bound it's Content Array to my AppDelegate and set

Getting model from click on NSCollectionVIew item

折月煮酒 提交于 2019-12-24 05:28:08
问题 I'm trying to put up a basic app with a tabbed interface, and it's been a few years since I've done any cocoa development so I'm rusty... My app will use tabs, and display a default view of items when you load a tab, allowing you to click on one of the items to swap in a view for that item (think chrome, when you open a new tab and it displays your favorite sites which you can click on to open). Currently I have implemented a basic single window UI for this almost entirely in interface

Propagate programmatic text field value changes to model using Cocoa Bindings

依然范特西╮ 提交于 2019-12-24 00:43:03
问题 I tried a very simple implementation, like this: @implementation ScrollingTextField - (void)scrollWheel:(NSEvent *)event { self.doubleValue -= event.scrollingDeltaY; } @end I bound the value of the scrolling text field to some other object. Scrolling now updates the visible text on the text field just fine. However, the bound value does not change. Why does the bound value not change? Or: How can I make the bound value recognize the change? 回答1: The bound value doesn't change by Apple's

What does Cocoa binding's NSHandlesContentAsCompoundValueBindingOption do exactly?

怎甘沉沦 提交于 2019-12-23 09:09:12
问题 When binding an NSArrayController 's contentArray to an NSUserDefaultsController , you have to check the "Handles Content As Compound Value" checkbox on the binding. This has become conventional wisdom, but what does the option actually do? I wrote a small test app and could observe that with the option turned on, the whole contentArray is passed to the binding source's setValue:forKey: whenever you edit a property of an element in the array. When the option is off, only the element object

Problems when deselecting checkboxes inside bound NSTableview's columns

徘徊边缘 提交于 2019-12-23 04:24:10
问题 I am using this project, created by aneesh171 that shows the creation of checkboxes inside NSTableView and how to bind them. I am new to OSX development and trying to understand how it works. The project is basically checkboxes inside a NSTableView's column that is bound to an array controller. For some reason, when I deselect one of those checkboxes, the following messages appear on the console window: 2014-04-03 04:22:55.579 MyApp[5735:303] Error setting value for key path objectValue

How to keep a child NSManagedObjectContext up to date when using bindings

北慕城南 提交于 2019-12-22 10:45:06
问题 I have a NSManagedObjectContext set to have a NSPrivateQueueConcurrencyType which I'm using most of the time across my app. As well as this I created a child MOC with NSMainQueueConcurrencyType for use with cocoa bindings (I hear that bindings don't work with private queue MOCs). I have bound some ObjectController s and an ArrayController to this child context. I very much want to keep the child on the main queue rather than swapping the MOC queue types. When I make changes to the bound

NSTextView textDidChange/didChangeText not called for bindings

徘徊边缘 提交于 2019-12-22 09:05:33
问题 I have a custom NSTextView implementation that automatically adjusts the font size so that the text fills the entire view. I overwrote didChangeText to call my font size adjustment method. Works great when the user is editing text, but didChangeText (and the delegate method textDidChange: ) are not called when the text view contents are set via bindings. The font adjustment code needs to run whenever the text is set/changes, not only when it's changed by the user. How can I detect all changes

Refresh Cocoa-Binding - NSArrayController - ComboBox

≯℡__Kan透↙ 提交于 2019-12-21 20:33:42
问题 in my application I made a very simple binding. I have a NSMutableArray bound to a NSArrayController. The controller itself is bound to a ComboBox and it shows all the content of the NSMutableArray. Works fine. The problem is : The content of the Array will change. If the user makes some adjustments to the app I delete all the items in the NSMuteableArray and fill it with new and different items. But the binding of NSMutableArray <-> NSArrayController <-> NSComboBox does not refresh. No

Binding a custom NSView: Does it demand creating an IBPlugin?

妖精的绣舞 提交于 2019-12-21 07:31:18
问题 I have created a subclass of NSView to draw an image as a pattern: @interface CePatternView : NSView { NSImage* image; id observableObjectForImage; NSString* keyPathForImage; } @end I implemented the following to expose bindings: + (void)initialize { // Expose the "image" binding to IB. [self exposeBinding:@"image"]; } - (Class)valueClassForBinding:(NSString *)binding { if([binding isEqualToString:@"image"]) return [NSImage class]; return nil; // Unknown binding } Unfortunately, the image