cocoa-bindings

Editable NSTableView with Bindings won't set values in model

放肆的年华 提交于 2019-12-11 02:28:46
问题 Here is my setup. In my application delegate, I have a property called currentFoo. The currentFoo property is set to the currently selected Foo instance. The Foo instances each have a property which is a NSMutableArray called results. The objects in results can be of various types, NSNumber, NSString, etc... I have an NSTableView that is displayed at certain times which allows the user to see the collection of results in the currentFoo. There is also UI to allow adding to and deleting from

NSPopButton with list of font families

三世轮回 提交于 2019-12-11 02:23:40
问题 How can I create a NSPopupButton with a list of font families where each item is in its own font as shown in the attached screenshot. I want to use bindings to achieve this. I am able to populate the NSPopupButton by binding NSPopupButton content to value returned by [[NSFontManager sharedFontManager] availableFontFamilies] but I can't figure out how to get each individual row in its own font? 回答1: I wasn't sure I could do it, but the following appears to work. // fontPopup1 is an instance of

How to force NSArrayController to reload MOC contents to reflect latest fresh data

旧街凉风 提交于 2019-12-11 02:18:25
问题 I am working on a Mac & iOS App, with iCloud CoreData in between to synchronize the data. When I update some thing from iOS App, and the updates are already migrated to the PersistentStore in Mac App while the Mac App is running. The problem is I cannot find an effective way to force the NSArrayController to reload all data from the store. tried -(void) fetch:(id)sender; only can see the delete or added entity, but the updated model property not refreshed... Please help. Thanks 回答1: If you

Table view not updating according to bindings - Part Two

女生的网名这么多〃 提交于 2019-12-11 01:54:11
问题 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 have a table view with three columns, whose Value bindings are bound to three properties of the arrangedObjects of an array controller. The array controller's contentArray is bound to the visitationResults of my document object; the items in that array are instances of a model class

Does Cocoa connection binding to NSToolbarItem prevent deinitializing?

好久不见. 提交于 2019-12-11 01:13:00
问题 Trying to set the selected segment of an NSToolbarItem that's an NSSegmentedControl via connection binding to a property (optionSegment). Subclassing the window controller as such class MyWindow: NSWindowController { dynamic var optionSegment: Int = 0 override func windowDidLoad() { super.windowDidLoad() } } Alternately, put the optionSegment property in the NSDocument subclass and bind to that. Each work. The problem is that with this binding, or seemingly any binding to NSToolbarItem , none

NSComboBox: How to tell user has typed in information that is not in the pop up list and read it

我与影子孤独终老i 提交于 2019-12-10 21:51:43
问题 I have an NSComboBox with a seperate class that conforms to NSComboBox dataSource and delegate. If the user types text into the combo box that that does not match one of the items in the pop up list, how do I receieve a notification that the user has typed something in and also read the value that the user has typed? At the moment I'm implimenting the delegate methods:- -(void)comboBoxSelectionDidChange:(NSNotification *)notification -(void)comboBoxWillDismiss:(NSNotification *)notification

Cocoa: How to bind a boolean property to NSCellStateValue?

此生再无相见时 提交于 2019-12-10 14:38:59
问题 I would like to bind the boolean enabled property of an NSTextField to the state of an NSButton . I already tried adding a custom NSValueTransformer that transforms the state of the NSButton into NSNumber . However, in that scenario the text fields are disabled all the time for some reason. My second approach: To bad fails also since NSValueTransformer does not offer return primitives types such as BOOL . Example: The screenshot shows an example in which the text fields are disabled because

What is the Cocoa Touch equivalent to NSArrayController?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 14:10:30
问题 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 objects such as table cells in Cocoa Touch? 回答1: If you're using CoreData on iPhone OS 3.0 and above, you'll want to look at NSFetchedResultsController . While not really an analog to NSArrayController , it is designed specifically to be used with UITableView and its controller. It provides a way to

Why are my images in my NSTableView faded out?

喜你入骨 提交于 2019-12-09 10:51:26
问题 To start, there's an NSArrayController ("Servers") whose content is an array of "server" objects. I also have an NSTableView with a column. The column is bound to Server's "arrangedObjects.status" property. I use a custom NSValueConverter to make that status into an image for the column's dataCell which is an NSImageCell . What I don't understand is why the images that show up in the column are correct, but consistently faded out. Just to test, I have the same image outside the table view for

How do you bind a storyboard view to a Core Data entity when using NSDocument?

穿精又带淫゛_ 提交于 2019-12-09 06:59:38
问题 I'm building an OS X app that uses core data, NSDocument, storyboards, and Cocoa bindings. My expectation is that the following occurs: An instance of MyDocument ( NSDocument subclass) is created. MyDocument creates a Core Data NSManagedObjectContext that represents the document's data. MyDocument instantiates an NSWindowController from the storyboard by its identifier. Within the storyboard, the window controller contains DocumentEditorViewController ( NSViewController subclass) which