cocoa-bindings

What is the new way of binding an NSArrayController to the managed object context of a Core Data document?

笑着哭i 提交于 2019-11-28 20:36:49
问题 Before Xcode went and added Storyboards for OS X apps you could connect an array controller to your document's managed object context by binding the Managed Object Context of the array controller to File's Owner with a Model Key Path of managedObjectContext . With storyboards there is no more File's Owner so where do you get the context from now? Apple's documentation is behind in this area and there aren't any obvious places to bind to in Xcode. Obviously I can just fall back to a non

iTunes-like count buttons using Cocoa bindings

馋奶兔 提交于 2019-11-28 12:42:56
问题 I want to display some items in my sidebar, with the count of each tag also displayed: How do I do this efficiently and automatically? The easy option would be to use cocoa bindings, but I'm not sure what the best way to do this: would each button needs it's own NSArrayController with a fetch predicate set for the 'tag'? That could end up with X number of NSArrayControllers (one for each tag) which would be pretty heavy-weight (I would think). The other option is to create fetch requests

Using an NSArrayController in Multiple Storyboard Scenes

我的梦境 提交于 2019-11-28 06:59:11
I have a Mac document-based Core Data application that uses storyboards. The storyboard has the following layout: Window Controller Split View Controller Table View Controller Text View Controller My Core Data model contains a Chapter entity that contains two attributes: title and contents. I want the table view to show each chapter title. The text view shows the contents of the selected chapter. If I was using a xib file, I would add an array controller to the xib file. I would bind the array controller to File's Owner to access my NSPersistentDocument subclass. I would bind the table view to

How do I bind my Array Controller to my core data model?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 06:36:06
问题 I'm new to SWIFT programming and am trying to do a simple app to learn to use core data and bind it to display in an app. I've looked at loads of examples but all seem to be old. I am working in XCode 9. I started with a MacOS Cocoa app with Core Data. I have a simple entity called "Workout" with 4 attributes date, seconds, sport and rpe. I then added a Array Controller under the view controller scene. I added a Table view which set the Array Controller as the data source. I've added buttons

Can you manually implement Cocoa bindings?

本小妞迷上赌 提交于 2019-11-27 19:10:22
问题 I've had a crack at implementing bindings for my own NSView subclass. It works, but there are problems with retain cycles when binding to File's Owner from a nib file. After reading into it a little, I discovered that Apple had the same problem a few years back but have fixed it with some magic undocumented class (NSAutounbinder). There is a lengthy discussion of the retain cycle problem here http://www.cocoabuilder.com/archive/message/cocoa/2004/6/12/109600 . The workaround is to to unbind

Cocoa Binding Mutable Dictionary with Search Field

廉价感情. 提交于 2019-11-27 19:05:09
问题 In my header file, I have a property declared @property (strong) NSMutableDictionary *myContents; In my implementation, I have assigned the contents of a plist (which are dictonaries) to the NSMutableDictionary. In my window, I have a NSSearchField that I would like to bind with the Dictionary and that is the problem. I have a few questions and still don't understand after reasearching. (1)Which should I use? NSObjectController, NSDictonaryController, or NSTreeController. (2)How should I bind

Can you manually implement Cocoa bindings?

妖精的绣舞 提交于 2019-11-27 17:13:14
I've had a crack at implementing bindings for my own NSView subclass. It works, but there are problems with retain cycles when binding to File's Owner from a nib file. After reading into it a little, I discovered that Apple had the same problem a few years back but have fixed it with some magic undocumented class (NSAutounbinder). There is a lengthy discussion of the retain cycle problem here http://www.cocoabuilder.com/archive/message/cocoa/2004/6/12/109600 . The workaround is to to unbind all bindings before the window controller is released , not before it is deallocated , in a place like

Is there a way to set up a NSCollectionView programmatically in Swift?

痞子三分冷 提交于 2019-11-27 15:24:55
问题 I'm coming from the iOS development and I am wondering if there is a way to set up a NSCollectionView programmatically like a UICollectionView in iOS? And add the NSCollectionViewItems in code. Or is the only way to set up a NSCollectionView to use bindings? Thank You! 回答1: Thanks to @stevesliva for pointing me to this SO answer. I converted it to Swift. This is what I got. I am creating a NSCollectionView in the ViewController: import Cocoa class ViewController: NSViewController { var titles

Should I need to unbind cocoa-bindings in dealloc of windowController?

一世执手 提交于 2019-11-27 15:17:41
I have window controller and view controller that use core data bindings, but I want to be able to have those views really, truly get deallocated. I then want to reset the managedObjectContext and at that point have given up as much memory as possible. I have found that I am required to unbind things which I've bound in the Nib, or the MOC keeps the Nib objects retained. The issue is this EXEC_BAD_ACCESS trace: If I do not unbind all of the bindings, even those created in Interface Builder, reset on the MOC causes an EXEC_BAD_ACCESS because bindings are attempting to reflect changes in the MOC

Is there any technical/conceptual reason why iOS does not support Cocoa Bindings? [closed]

泄露秘密 提交于 2019-11-27 12:45:38
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Cocoa for Mac OS X support Cocoa Binding technology, reducing need of glue code between your views and your models. Recreating Cocoa